Skip to content

Explain how to aquire a Document #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/Web/DOM/Document.purs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,22 @@
-- |
-- | The DOM API doesn't actually give you any way of getting hold of a
-- | `Document` by itself. To do that, you will need to look at one of the
-- | other APIs which build on the DOM API. For example, `window.document` is
-- | other APIs which build on the DOM API.
-- |
-- | For example, `window.document` is
-- | part of the HTML5 API, and so the relevant binding can be found in
-- | `Web.HTML.Window`, which is part of the `purescript-web-html` package.
-- | So here is one way to acquire an HTML5 `Document` from functions
-- | in `purescript-web-html`:
-- |
-- | ```purescript
-- | import Web.HTML (window)
-- | import Web.HTML.Window (document)
-- | import Web.HTML.HTMLDocument (toDocument)
-- |
-- | do
-- | doc <- map toDocument $ document =<< window
-- | ```
module Web.DOM.Document
( Document
, fromNode
Expand Down