{-# LANGUAGE PatternSynonyms, ForeignFunctionInterface, JavaScriptFFI #-} module GHCJS.DOM.JSFFI.Generated.Node (js_insertBefore, insertBefore, js_replaceChild, replaceChild, js_removeChild, removeChild, js_appendChild, appendChild, js_hasChildNodes, hasChildNodes, js_cloneNode, cloneNode, js_normalize, normalize, js_isSupported, isSupported, js_isSameNode, isSameNode, js_isEqualNode, isEqualNode, js_lookupPrefix, lookupPrefix, js_isDefaultNamespace, isDefaultNamespace, js_lookupNamespaceURI, lookupNamespaceURI, js_compareDocumentPosition, compareDocumentPosition, js_contains, contains, pattern ELEMENT_NODE, pattern ATTRIBUTE_NODE, pattern TEXT_NODE, pattern CDATA_SECTION_NODE, pattern ENTITY_REFERENCE_NODE, pattern ENTITY_NODE, pattern PROCESSING_INSTRUCTION_NODE, pattern COMMENT_NODE, pattern DOCUMENT_NODE, pattern DOCUMENT_TYPE_NODE, pattern DOCUMENT_FRAGMENT_NODE, pattern NOTATION_NODE, pattern DOCUMENT_POSITION_DISCONNECTED, pattern DOCUMENT_POSITION_PRECEDING, pattern DOCUMENT_POSITION_FOLLOWING, pattern DOCUMENT_POSITION_CONTAINS, pattern DOCUMENT_POSITION_CONTAINED_BY, pattern DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, js_getNodeName, getNodeName, js_setNodeValue, setNodeValue, js_getNodeValue, getNodeValue, js_getNodeType, getNodeType, js_getParentNode, getParentNode, js_getChildNodes, getChildNodes, js_getFirstChild, getFirstChild, js_getLastChild, getLastChild, js_getPreviousSibling, getPreviousSibling, js_getNextSibling, getNextSibling, js_getOwnerDocument, getOwnerDocument, js_getNamespaceURI, getNamespaceURI, js_setPrefix, setPrefix, js_getPrefix, getPrefix, js_getLocalName, getLocalName, js_getBaseURI, getBaseURI, js_setTextContent, setTextContent, js_getTextContent, getTextContent, js_getParentElement, getParentElement, Node, castToNode, gTypeNode, IsNode, toNode) where import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, fmap, Show, Read, Eq, Ord) import Data.Typeable (Typeable) import GHCJS.Types (JSRef(..), JSString) import GHCJS.Foreign (jsNull) import GHCJS.Foreign.Callback (syncCallback, asyncCallback, syncCallback1, asyncCallback1, syncCallback2, asyncCallback2, OnBlocked(..)) import GHCJS.Marshal (ToJSRef(..), FromJSRef(..)) import GHCJS.Marshal.Pure (PToJSRef(..), PFromJSRef(..)) import Control.Monad.IO.Class (MonadIO(..)) import Data.Int (Int64) import Data.Word (Word, Word64) import GHCJS.DOM.Types import Control.Applicative ((<$>)) import GHCJS.DOM.EventTargetClosures (EventName, unsafeEventName) import GHCJS.DOM.Enums foreign import javascript unsafe "$1[\"insertBefore\"]($2, $3)" js_insertBefore :: Node -> Nullable Node -> Nullable Node -> IO (Nullable Node) -- | insertBefore :: (MonadIO m, IsNode self, IsNode newChild, IsNode refChild) => self -> Maybe newChild -> Maybe refChild -> m (Maybe Node) insertBefore self newChild refChild = liftIO (nullableToMaybe <$> (js_insertBefore (toNode self) (maybeToNullable (fmap toNode newChild)) (maybeToNullable (fmap toNode refChild)))) foreign import javascript unsafe "$1[\"replaceChild\"]($2, $3)" js_replaceChild :: Node -> Nullable Node -> Nullable Node -> IO (Nullable Node) -- | replaceChild :: (MonadIO m, IsNode self, IsNode newChild, IsNode oldChild) => self -> Maybe newChild -> Maybe oldChild -> m (Maybe Node) replaceChild self newChild oldChild = liftIO (nullableToMaybe <$> (js_replaceChild (toNode self) (maybeToNullable (fmap toNode newChild)) (maybeToNullable (fmap toNode oldChild)))) foreign import javascript unsafe "$1[\"removeChild\"]($2)" js_removeChild :: Node -> Nullable Node -> IO (Nullable Node) -- | removeChild :: (MonadIO m, IsNode self, IsNode oldChild) => self -> Maybe oldChild -> m (Maybe Node) removeChild self oldChild = liftIO (nullableToMaybe <$> (js_removeChild (toNode self) (maybeToNullable (fmap toNode oldChild)))) foreign import javascript unsafe "$1[\"appendChild\"]($2)" js_appendChild :: Node -> Nullable Node -> IO (Nullable Node) -- | appendChild :: (MonadIO m, IsNode self, IsNode newChild) => self -> Maybe newChild -> m (Maybe Node) appendChild self newChild = liftIO (nullableToMaybe <$> (js_appendChild (toNode self) (maybeToNullable (fmap toNode newChild)))) foreign import javascript unsafe "($1[\"hasChildNodes\"]() ? 1 : 0)" js_hasChildNodes :: Node -> IO Bool -- | hasChildNodes :: (MonadIO m, IsNode self) => self -> m Bool hasChildNodes self = liftIO (js_hasChildNodes (toNode self)) foreign import javascript unsafe "$1[\"cloneNode\"]($2)" js_cloneNode :: Node -> Bool -> IO (Nullable Node) -- | cloneNode :: (MonadIO m, IsNode self) => self -> Bool -> m (Maybe Node) cloneNode self deep = liftIO (nullableToMaybe <$> (js_cloneNode (toNode self) deep)) foreign import javascript unsafe "$1[\"normalize\"]()" js_normalize :: Node -> IO () -- | normalize :: (MonadIO m, IsNode self) => self -> m () normalize self = liftIO (js_normalize (toNode self)) foreign import javascript unsafe "($1[\"isSupported\"]($2,\n$3) ? 1 : 0)" js_isSupported :: Node -> JSString -> Nullable JSString -> IO Bool -- | isSupported :: (MonadIO m, IsNode self, ToJSString feature, ToJSString version) => self -> feature -> Maybe version -> m Bool isSupported self feature version = liftIO (js_isSupported (toNode self) (toJSString feature) (toMaybeJSString version)) foreign import javascript unsafe "($1[\"isSameNode\"]($2) ? 1 : 0)" js_isSameNode :: Node -> Nullable Node -> IO Bool -- | isSameNode :: (MonadIO m, IsNode self, IsNode other) => self -> Maybe other -> m Bool isSameNode self other = liftIO (js_isSameNode (toNode self) (maybeToNullable (fmap toNode other))) foreign import javascript unsafe "($1[\"isEqualNode\"]($2) ? 1 : 0)" js_isEqualNode :: Node -> Nullable Node -> IO Bool -- | isEqualNode :: (MonadIO m, IsNode self, IsNode other) => self -> Maybe other -> m Bool isEqualNode self other = liftIO (js_isEqualNode (toNode self) (maybeToNullable (fmap toNode other))) foreign import javascript unsafe "$1[\"lookupPrefix\"]($2)" js_lookupPrefix :: Node -> Nullable JSString -> IO (Nullable JSString) -- | lookupPrefix :: (MonadIO m, IsNode self, ToJSString namespaceURI, FromJSString result) => self -> Maybe namespaceURI -> m (Maybe result) lookupPrefix self namespaceURI = liftIO (fromMaybeJSString <$> (js_lookupPrefix (toNode self) (toMaybeJSString namespaceURI))) foreign import javascript unsafe "($1[\"isDefaultNamespace\"]($2) ? 1 : 0)" js_isDefaultNamespace :: Node -> Nullable JSString -> IO Bool -- | isDefaultNamespace :: (MonadIO m, IsNode self, ToJSString namespaceURI) => self -> Maybe namespaceURI -> m Bool isDefaultNamespace self namespaceURI = liftIO (js_isDefaultNamespace (toNode self) (toMaybeJSString namespaceURI)) foreign import javascript unsafe "$1[\"lookupNamespaceURI\"]($2)" js_lookupNamespaceURI :: Node -> Nullable JSString -> IO (Nullable JSString) -- | lookupNamespaceURI :: (MonadIO m, IsNode self, ToJSString prefix, FromJSString result) => self -> Maybe prefix -> m (Maybe result) lookupNamespaceURI self prefix = liftIO (fromMaybeJSString <$> (js_lookupNamespaceURI (toNode self) (toMaybeJSString prefix))) foreign import javascript unsafe "$1[\"compareDocumentPosition\"]($2)" js_compareDocumentPosition :: Node -> Nullable Node -> IO Word -- | compareDocumentPosition :: (MonadIO m, IsNode self, IsNode other) => self -> Maybe other -> m Word compareDocumentPosition self other = liftIO (js_compareDocumentPosition (toNode self) (maybeToNullable (fmap toNode other))) foreign import javascript unsafe "($1[\"contains\"]($2) ? 1 : 0)" js_contains :: Node -> Nullable Node -> IO Bool -- | contains :: (MonadIO m, IsNode self, IsNode other) => self -> Maybe other -> m Bool contains self other = liftIO (js_contains (toNode self) (maybeToNullable (fmap toNode other))) pattern ELEMENT_NODE = 1 pattern ATTRIBUTE_NODE = 2 pattern TEXT_NODE = 3 pattern CDATA_SECTION_NODE = 4 pattern ENTITY_REFERENCE_NODE = 5 pattern ENTITY_NODE = 6 pattern PROCESSING_INSTRUCTION_NODE = 7 pattern COMMENT_NODE = 8 pattern DOCUMENT_NODE = 9 pattern DOCUMENT_TYPE_NODE = 10 pattern DOCUMENT_FRAGMENT_NODE = 11 pattern NOTATION_NODE = 12 pattern DOCUMENT_POSITION_DISCONNECTED = 1 pattern DOCUMENT_POSITION_PRECEDING = 2 pattern DOCUMENT_POSITION_FOLLOWING = 4 pattern DOCUMENT_POSITION_CONTAINS = 8 pattern DOCUMENT_POSITION_CONTAINED_BY = 16 pattern DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 32 foreign import javascript unsafe "$1[\"nodeName\"]" js_getNodeName :: Node -> IO (Nullable JSString) -- | getNodeName :: (MonadIO m, IsNode self, FromJSString result) => self -> m (Maybe result) getNodeName self = liftIO (fromMaybeJSString <$> (js_getNodeName (toNode self))) foreign import javascript unsafe "$1[\"nodeValue\"] = $2;" js_setNodeValue :: Node -> Nullable JSString -> IO () -- | setNodeValue :: (MonadIO m, IsNode self, ToJSString val) => self -> Maybe val -> m () setNodeValue self val = liftIO (js_setNodeValue (toNode self) (toMaybeJSString val)) foreign import javascript unsafe "$1[\"nodeValue\"]" js_getNodeValue :: Node -> IO (Nullable JSString) -- | getNodeValue :: (MonadIO m, IsNode self, FromJSString result) => self -> m (Maybe result) getNodeValue self = liftIO (fromMaybeJSString <$> (js_getNodeValue (toNode self))) foreign import javascript unsafe "$1[\"nodeType\"]" js_getNodeType :: Node -> IO Word -- | getNodeType :: (MonadIO m, IsNode self) => self -> m Word getNodeType self = liftIO (js_getNodeType (toNode self)) foreign import javascript unsafe "$1[\"parentNode\"]" js_getParentNode :: Node -> IO (Nullable Node) -- | getParentNode :: (MonadIO m, IsNode self) => self -> m (Maybe Node) getParentNode self = liftIO (nullableToMaybe <$> (js_getParentNode (toNode self))) foreign import javascript unsafe "$1[\"childNodes\"]" js_getChildNodes :: Node -> IO (Nullable NodeList) -- | getChildNodes :: (MonadIO m, IsNode self) => self -> m (Maybe NodeList) getChildNodes self = liftIO (nullableToMaybe <$> (js_getChildNodes (toNode self))) foreign import javascript unsafe "$1[\"firstChild\"]" js_getFirstChild :: Node -> IO (Nullable Node) -- | getFirstChild :: (MonadIO m, IsNode self) => self -> m (Maybe Node) getFirstChild self = liftIO (nullableToMaybe <$> (js_getFirstChild (toNode self))) foreign import javascript unsafe "$1[\"lastChild\"]" js_getLastChild :: Node -> IO (Nullable Node) -- | getLastChild :: (MonadIO m, IsNode self) => self -> m (Maybe Node) getLastChild self = liftIO (nullableToMaybe <$> (js_getLastChild (toNode self))) foreign import javascript unsafe "$1[\"previousSibling\"]" js_getPreviousSibling :: Node -> IO (Nullable Node) -- | getPreviousSibling :: (MonadIO m, IsNode self) => self -> m (Maybe Node) getPreviousSibling self = liftIO (nullableToMaybe <$> (js_getPreviousSibling (toNode self))) foreign import javascript unsafe "$1[\"nextSibling\"]" js_getNextSibling :: Node -> IO (Nullable Node) -- | getNextSibling :: (MonadIO m, IsNode self) => self -> m (Maybe Node) getNextSibling self = liftIO (nullableToMaybe <$> (js_getNextSibling (toNode self))) foreign import javascript unsafe "$1[\"ownerDocument\"]" js_getOwnerDocument :: Node -> IO (Nullable Document) -- | getOwnerDocument :: (MonadIO m, IsNode self) => self -> m (Maybe Document) getOwnerDocument self = liftIO (nullableToMaybe <$> (js_getOwnerDocument (toNode self))) foreign import javascript unsafe "$1[\"namespaceURI\"]" js_getNamespaceURI :: Node -> IO (Nullable JSString) -- | getNamespaceURI :: (MonadIO m, IsNode self, FromJSString result) => self -> m (Maybe result) getNamespaceURI self = liftIO (fromMaybeJSString <$> (js_getNamespaceURI (toNode self))) foreign import javascript unsafe "$1[\"prefix\"] = $2;" js_setPrefix :: Node -> Nullable JSString -> IO () -- | setPrefix :: (MonadIO m, IsNode self, ToJSString val) => self -> Maybe val -> m () setPrefix self val = liftIO (js_setPrefix (toNode self) (toMaybeJSString val)) foreign import javascript unsafe "$1[\"prefix\"]" js_getPrefix :: Node -> IO (Nullable JSString) -- | getPrefix :: (MonadIO m, IsNode self, FromJSString result) => self -> m (Maybe result) getPrefix self = liftIO (fromMaybeJSString <$> (js_getPrefix (toNode self))) foreign import javascript unsafe "$1[\"localName\"]" js_getLocalName :: Node -> IO (Nullable JSString) -- | getLocalName :: (MonadIO m, IsNode self, FromJSString result) => self -> m (Maybe result) getLocalName self = liftIO (fromMaybeJSString <$> (js_getLocalName (toNode self))) foreign import javascript unsafe "$1[\"baseURI\"]" js_getBaseURI :: Node -> IO (Nullable JSString) -- | getBaseURI :: (MonadIO m, IsNode self, FromJSString result) => self -> m (Maybe result) getBaseURI self = liftIO (fromMaybeJSString <$> (js_getBaseURI (toNode self))) foreign import javascript unsafe "$1[\"textContent\"] = $2;" js_setTextContent :: Node -> Nullable JSString -> IO () -- | setTextContent :: (MonadIO m, IsNode self, ToJSString val) => self -> Maybe val -> m () setTextContent self val = liftIO (js_setTextContent (toNode self) (toMaybeJSString val)) foreign import javascript unsafe "$1[\"textContent\"]" js_getTextContent :: Node -> IO (Nullable JSString) -- | getTextContent :: (MonadIO m, IsNode self, FromJSString result) => self -> m (Maybe result) getTextContent self = liftIO (fromMaybeJSString <$> (js_getTextContent (toNode self))) foreign import javascript unsafe "$1[\"parentElement\"]" js_getParentElement :: Node -> IO (Nullable Element) -- | getParentElement :: (MonadIO m, IsNode self) => self -> m (Maybe Element) getParentElement self = liftIO (nullableToMaybe <$> (js_getParentElement (toNode self)))