Skip to content
Open
Changes from 1 commit
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
Next Next commit
Explain how to aquire a Document
I couldn't figure out how to acquire a `Document` until I googled for it and found this https://lobste.rs/s/wa99yt/coming_purescript_from_haskell_reflex

I think we should explain this better.
  • Loading branch information
jamesdbrock authored Jan 25, 2021
commit 5376b4260b3539afc46924440463165d175ef36f
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 <- toDocument <$> document =<< window
-- | ```
module Web.DOM.Document
( Document
, fromNode
Expand Down