{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.ParentNode
(prepend, append, querySelector, querySelector_,
querySelectorUnsafe, querySelectorUnchecked, querySelectorAll,
querySelectorAll_, getChildren, getFirstElementChild,
getFirstElementChildUnsafe, getFirstElementChildUnchecked,
getLastElementChild, getLastElementChildUnsafe,
getLastElementChildUnchecked, getChildElementCount, ParentNode(..),
gTypeParentNode, IsParentNode, toParentNode)
where
import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, realToFrac, fmap, Show, Read, Eq, Ord, Maybe(..))
import qualified Prelude (error)
import Data.Typeable (Typeable)
import Data.Traversable (mapM)
import Language.Javascript.JSaddle (JSM(..), JSVal(..), JSString, strictEqual, toJSVal, valToStr, valToNumber, valToBool, js, jss, jsf, jsg, function, asyncFunction, new, array, jsUndefined, (!), (!!))
import Data.Int (Int64)
import Data.Word (Word, Word64)
import JSDOM.Types
import Control.Applicative ((<$>))
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Enums
prepend ::
(MonadDOM m, IsParentNode self, IsNodeOrString nodes) =>
self -> [nodes] -> m ()
prepend self nodes
= liftDOM
(void
((toParentNode self) ^. jsf "prepend" [toJSVal (array nodes)]))
append ::
(MonadDOM m, IsParentNode self, IsNodeOrString nodes) =>
self -> [nodes] -> m ()
append self nodes
= liftDOM
(void
((toParentNode self) ^. jsf "append" [toJSVal (array nodes)]))
querySelector ::
(MonadDOM m, IsParentNode self, ToJSString selectors) =>
self -> selectors -> m (Maybe Element)
querySelector self selectors
= liftDOM
(((toParentNode self) ^. jsf "querySelector" [toJSVal selectors])
>>= fromJSVal)
querySelector_ ::
(MonadDOM m, IsParentNode self, ToJSString selectors) =>
self -> selectors -> m ()
querySelector_ self selectors
= liftDOM
(void
((toParentNode self) ^. jsf "querySelector" [toJSVal selectors]))
querySelectorUnsafe ::
(MonadDOM m, IsParentNode self, ToJSString selectors,
HasCallStack) =>
self -> selectors -> m Element
querySelectorUnsafe self selectors
= liftDOM
((((toParentNode self) ^. jsf "querySelector" [toJSVal selectors])
>>= fromJSVal)
>>= maybe (Prelude.error "Nothing to return") return)
querySelectorUnchecked ::
(MonadDOM m, IsParentNode self, ToJSString selectors) =>
self -> selectors -> m Element
querySelectorUnchecked self selectors
= liftDOM
(((toParentNode self) ^. jsf "querySelector" [toJSVal selectors])
>>= fromJSValUnchecked)
querySelectorAll ::
(MonadDOM m, IsParentNode self, ToJSString selectors) =>
self -> selectors -> m NodeList
querySelectorAll self selectors
= liftDOM
(((toParentNode self) ^. jsf "querySelectorAll"
[toJSVal selectors])
>>= fromJSValUnchecked)
querySelectorAll_ ::
(MonadDOM m, IsParentNode self, ToJSString selectors) =>
self -> selectors -> m ()
querySelectorAll_ self selectors
= liftDOM
(void
((toParentNode self) ^. jsf "querySelectorAll"
[toJSVal selectors]))
getChildren ::
(MonadDOM m, IsParentNode self) => self -> m HTMLCollection
getChildren self
= liftDOM
(((toParentNode self) ^. js "children") >>= fromJSValUnchecked)
getFirstElementChild ::
(MonadDOM m, IsParentNode self) => self -> m (Maybe Element)
getFirstElementChild self
= liftDOM
(((toParentNode self) ^. js "firstElementChild") >>= fromJSVal)
getFirstElementChildUnsafe ::
(MonadDOM m, IsParentNode self, HasCallStack) => self -> m Element
getFirstElementChildUnsafe self
= liftDOM
((((toParentNode self) ^. js "firstElementChild") >>= fromJSVal)
>>= maybe (Prelude.error "Nothing to return") return)
getFirstElementChildUnchecked ::
(MonadDOM m, IsParentNode self) => self -> m Element
getFirstElementChildUnchecked self
= liftDOM
(((toParentNode self) ^. js "firstElementChild") >>=
fromJSValUnchecked)
getLastElementChild ::
(MonadDOM m, IsParentNode self) => self -> m (Maybe Element)
getLastElementChild self
= liftDOM
(((toParentNode self) ^. js "lastElementChild") >>= fromJSVal)
getLastElementChildUnsafe ::
(MonadDOM m, IsParentNode self, HasCallStack) => self -> m Element
getLastElementChildUnsafe self
= liftDOM
((((toParentNode self) ^. js "lastElementChild") >>= fromJSVal) >>=
maybe (Prelude.error "Nothing to return") return)
getLastElementChildUnchecked ::
(MonadDOM m, IsParentNode self) => self -> m Element
getLastElementChildUnchecked self
= liftDOM
(((toParentNode self) ^. js "lastElementChild") >>=
fromJSValUnchecked)
getChildElementCount ::
(MonadDOM m, IsParentNode self) => self -> m Word
getChildElementCount self
= liftDOM
(round <$>
(((toParentNode self) ^. js "childElementCount") >>= valToNumber))