@@ -129,7 +129,7 @@ import Data.Some (Some)
129129import qualified Data.Some as Some
130130import Data.Text (Text)
131131import 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)
133133import GHCJS.DOM.Element (getScrollTop, removeAttribute, removeAttributeNS, setAttribute, setAttributeNS)
134134import qualified GHCJS.DOM.Element as Element
135135import qualified GHCJS.DOM.Event as Event
@@ -257,6 +257,14 @@ textNodeInternal !t = do
257257 append $ toNode n
258258 return n
259259
260+{-# INLINABLE commentNodeInternal #-}
261+commentNodeInternal :: (MonadJSM m, ToDOMString contents) => contents -> ImmediateDomBuilderT t m DOM.Comment
262+commentNodeInternal !t = do
263+ doc <- askDocument
264+ n <- liftJSM $ createComment doc t
265+ append $ toNode n
266+ return n
267+
260268-- | s and e must both be children of the same node and s must precede e;
261269-- all nodes between s and e will be removed, but s and e will not be removed
262270deleteBetweenExclusive :: (MonadJSM m, IsNode start, IsNode end) => start -> end -> m ()
@@ -384,6 +392,7 @@ instance DomSpace GhcjsDomSpace where
384392 type EventSpec GhcjsDomSpace = GhcjsEventSpec
385393 type RawDocument GhcjsDomSpace = DOM.Document
386394 type RawTextNode GhcjsDomSpace = DOM.Text
395+ type RawCommentNode GhcjsDomSpace = DOM.Comment
387396 type RawElement GhcjsDomSpace = DOM.Element
388397 type RawFile GhcjsDomSpace = DOM.File
389398 type RawInputElement GhcjsDomSpace = DOM.HTMLInputElement
@@ -462,6 +471,11 @@ instance SupportsImmediateDomBuilder t m => DomBuilder t (ImmediateDomBuilderT t
462471 n <- textNodeInternal initialContents
463472 mapM_ (requestDomAction_ . fmap (setNodeValue n . Just)) mSetContents
464473 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
465479 {-# INLINABLE element #-}
466480 element elementTag cfg child = fst <$> makeElement elementTag cfg child
467481 {-# INLINABLE inputElement #-}