@@ -129,7 +129,7 @@ import Data.Some (Some)
129import qualified Data.Some as Some
129import qualified Data.Some as Some
130import Data.Text (Text)
130import Data.Text (Text)
131import qualified GHCJS.DOM as DOM
131import qualified GHCJS.DOM as DOM
132−import GHCJS.DOM.Document (Document, createDocumentFragment, createElement, createElementNS, createTextNode)
132+import GHCJS.DOM.Document (Document, createDocumentFragment, createElement, createElementNS, createTextNode, createComment)
133import GHCJS.DOM.Element (getScrollTop, removeAttribute, removeAttributeNS, setAttribute, setAttributeNS)
133import GHCJS.DOM.Element (getScrollTop, removeAttribute, removeAttributeNS, setAttribute, setAttributeNS)
134import qualified GHCJS.DOM.Element as Element
134import qualified GHCJS.DOM.Element as Element
135import qualified GHCJS.DOM.Event as Event
135import qualified GHCJS.DOM.Event as Event
@@ -257,6 +257,14 @@ textNodeInternal !t = do
257 append $ toNode n
257 append $ toNode n
260+{-# INLINABLE commentNodeInternal #-}
261+commentNodeInternal :: (MonadJSM m, ToDOMString contents) => contents -> ImmediateDomBuilderT t m DOM.Comment
262+commentNodeInternal !t = do
264+ n <- liftJSM $ createComment doc t
260-- | s and e must both be children of the same node and s must precede e;
268-- | s and e must both be children of the same node and s must precede e;
261-- all nodes between s and e will be removed, but s and e will not be removed
269-- all nodes between s and e will be removed, but s and e will not be removed
262deleteBetweenExclusive :: (MonadJSM m, IsNode start, IsNode end) => start -> end -> m ()
270deleteBetweenExclusive :: (MonadJSM m, IsNode start, IsNode end) => start -> end -> m ()
@@ -384,6 +392,7 @@ instance DomSpace GhcjsDomSpace where
384 type EventSpec GhcjsDomSpace = GhcjsEventSpec
392 type EventSpec GhcjsDomSpace = GhcjsEventSpec
385 type RawDocument GhcjsDomSpace = DOM.Document
393 type RawDocument GhcjsDomSpace = DOM.Document
386 type RawTextNode GhcjsDomSpace = DOM.Text
394 type RawTextNode GhcjsDomSpace = DOM.Text
395+ type RawCommentNode GhcjsDomSpace = DOM.Comment
387 type RawElement GhcjsDomSpace = DOM.Element
396 type RawElement GhcjsDomSpace = DOM.Element
388 type RawFile GhcjsDomSpace = DOM.File
397 type RawFile GhcjsDomSpace = DOM.File
389 type RawInputElement GhcjsDomSpace = DOM.HTMLInputElement
398 type RawInputElement GhcjsDomSpace = DOM.HTMLInputElement
@@ -462,6 +471,11 @@ instance SupportsImmediateDomBuilder t m => DomBuilder t (ImmediateDomBuilderT t
462 n <- textNodeInternal initialContents
471 n <- textNodeInternal initialContents
463 mapM_ (requestDomAction_ . fmap (setNodeValue n . Just)) mSetContents
472 mapM_ (requestDomAction_ . fmap (setNodeValue n . Just)) mSetContents
464 return $ TextNode n
473 return $ TextNode n
474+ {-# INLINABLE commentNode #-}
475+ commentNode (CommentNodeConfig initialContents mSetContents) = do
476+ n <- commentNodeInternal initialContents
477+ mapM_ (requestDomAction_ . fmap (setNodeValue n . Just)) mSetContents
478+ return $ CommentNode n
465 {-# INLINABLE element #-}
479 {-# INLINABLE element #-}
466 element elementTag cfg child = fst <$> makeElement elementTag cfg child
480 element elementTag cfg child = fst <$> makeElement elementTag cfg child
467 {-# INLINABLE inputElement #-}
481 {-# INLINABLE inputElement #-}