@@ -39,16 +39,21 @@ module Web.DOM.Document
3939
4040import Prelude
4141
42- import Data.Maybe (Maybe )
42+ import Data.Maybe (Maybe , fromMaybe )
4343import Data.Nullable (Nullable , toMaybe , toNullable )
4444import Effect (Effect )
4545import Unsafe.Coerce (unsafeCoerce )
46+ import Web.DOM.ClassName (ClassName )
4647import Web.DOM.Comment (Comment )
48+ import Web.DOM.Document.CompatMode (CompatMode )
49+ import Web.DOM.Document.CompatMode as CompatMode
4750import Web.DOM.DocumentFragment (DocumentFragment )
4851import Web.DOM.DocumentType (DocumentType )
4952import Web.DOM.Element (Element )
53+ import Web.DOM.ElementName (ElementName )
5054import Web.DOM.HTMLCollection (HTMLCollection )
5155import Web.DOM.Internal.Types (Node )
56+ import Web.DOM.NamespaceURI (NamespaceURI )
5257import Web.DOM.NonElementParentNode (NonElementParentNode )
5358import Web.DOM.ParentNode (ParentNode )
5459import Web.DOM.ProcessingInstruction (ProcessingInstruction )
@@ -85,7 +90,12 @@ toEventTarget = unsafeCoerce
8590foreign import url :: Document -> Effect String
8691foreign import documentURI :: Document -> Effect String
8792foreign import origin :: Document -> Effect String
88- foreign import compatMode :: Document -> Effect String
93+
94+ foreign import _compatMode :: Document -> Effect String
95+
96+ compatMode :: Document -> Effect CompatMode
97+ compatMode doc = fromMaybe CompatMode.CSS1Compat <<< CompatMode .parse <$> _compatMode doc
98+
8999foreign import characterSet :: Document -> Effect String
90100foreign import contentType :: Document -> Effect String
91101
@@ -99,20 +109,20 @@ documentElement = map toMaybe <<< _documentElement
99109
100110foreign import _documentElement :: Document -> Effect (Nullable Element )
101111
102- foreign import getElementsByTagName :: String -> Document -> Effect HTMLCollection
112+ foreign import getElementsByTagName :: ElementName -> Document -> Effect HTMLCollection
103113
104- getElementsByTagNameNS :: Maybe String -> String -> Document -> Effect HTMLCollection
114+ getElementsByTagNameNS :: Maybe NamespaceURI -> ElementName -> Document -> Effect HTMLCollection
105115getElementsByTagNameNS = _getElementsByTagNameNS <<< toNullable
106116
107- foreign import _getElementsByTagNameNS :: Nullable String -> String -> Document -> Effect HTMLCollection
108- foreign import getElementsByClassName :: String -> Document -> Effect HTMLCollection
117+ foreign import _getElementsByTagNameNS :: Nullable NamespaceURI -> ElementName -> Document -> Effect HTMLCollection
118+ foreign import getElementsByClassName :: ClassName -> Document -> Effect HTMLCollection
109119
110- foreign import createElement :: String -> Document -> Effect Element
120+ foreign import createElement :: ElementName -> Document -> Effect Element
111121
112- createElementNS :: Maybe String -> String -> Document -> Effect Element
122+ createElementNS :: Maybe NamespaceURI -> ElementName -> Document -> Effect Element
113123createElementNS = _createElementNS <<< toNullable
114124
115- foreign import _createElementNS :: Nullable String -> String -> Document -> Effect Element
125+ foreign import _createElementNS :: Nullable NamespaceURI -> ElementName -> Document -> Effect Element
116126foreign import createDocumentFragment :: Document -> Effect DocumentFragment
117127foreign import createTextNode :: String -> Document -> Effect Text
118128foreign import createComment :: String -> Document -> Effect Comment
0 commit comments