Safe Haskell | None |
---|---|
Language | Haskell98 |
- newtype Elem = Elem JSAny
- type PropID = String
- type ElemID = String
- type QuerySelector = String
- type ElemClass = String
- data Attribute
- data AttrName
- type AttrValue = String
- set :: MonadIO m => Elem -> [Attribute] -> m ()
- style :: String -> AttrName
- attr :: String -> AttrName
- with :: MonadIO m => m Elem -> [Attribute] -> m Elem
- (=:) :: AttrName -> AttrValue -> Attribute
- newElem :: MonadIO m => String -> m Elem
- newTextElem :: MonadIO m => String -> m Elem
- elemById :: MonadIO m => ElemID -> m (Maybe Elem)
- elemsByQS :: MonadIO m => Elem -> QuerySelector -> m [Elem]
- elemsByClass :: MonadIO m => ElemClass -> m [Elem]
- setProp :: MonadIO m => Elem -> PropID -> String -> m ()
- getProp :: MonadIO m => Elem -> PropID -> m String
- setAttr :: MonadIO m => Elem -> PropID -> String -> m ()
- getAttr :: MonadIO m => Elem -> PropID -> m String
- setProp' :: MonadIO m => Elem -> JSString -> JSString -> m ()
- getProp' :: MonadIO m => Elem -> JSString -> m JSString
- getValue :: (MonadIO m, JSType a) => Elem -> m (Maybe a)
- withElem :: MonadIO m => ElemID -> (Elem -> m a) -> m a
- withElems :: MonadIO m => [ElemID] -> ([Elem] -> m a) -> m a
- withElemsQS :: MonadIO m => Elem -> QuerySelector -> ([Elem] -> m a) -> m a
- mapQS :: MonadIO m => Elem -> QuerySelector -> (Elem -> m a) -> m [a]
- mapQS_ :: MonadIO m => Elem -> QuerySelector -> (Elem -> m a) -> m ()
- addChild :: MonadIO m => Elem -> Elem -> m ()
- addChildBefore :: MonadIO m => Elem -> Elem -> Elem -> m ()
- removeChild :: MonadIO m => Elem -> Elem -> m ()
- clearChildren :: MonadIO m => Elem -> m ()
- getChildBefore :: MonadIO m => Elem -> m (Maybe Elem)
- getFirstChild :: MonadIO m => Elem -> m (Maybe Elem)
- getLastChild :: MonadIO m => Elem -> m (Maybe Elem)
- getChildren :: MonadIO m => Elem -> m [Elem]
- setChildren :: MonadIO m => Elem -> [Elem] -> m ()
- getStyle :: MonadIO m => Elem -> PropID -> m String
- setStyle :: MonadIO m => Elem -> PropID -> String -> m ()
- getStyle' :: MonadIO m => Elem -> JSString -> m JSString
- setStyle' :: MonadIO m => Elem -> JSString -> JSString -> m ()
- getFileData :: MonadIO m => Elem -> Int -> m (Maybe Blob)
- getFileName :: MonadIO m => Elem -> m String
- setClass :: MonadIO m => Elem -> String -> Bool -> m ()
- toggleClass :: MonadIO m => Elem -> String -> m ()
- hasClass :: MonadIO m => Elem -> String -> m Bool
- click :: MonadIO m => Elem -> m ()
- focus :: MonadIO m => Elem -> m ()
- blur :: MonadIO m => Elem -> m ()
- document :: Elem
- documentBody :: Elem
Documentation
type QuerySelector = String Source
A key/value pair representing the value of an attribute. May represent a property, an HTML attribute or a style attribute.
The name of an attribute. May be either a common property, an HTML attribute or a style attribute.
newTextElem :: MonadIO m => String -> m Elem Source
Create a text node.
elemsByQS :: MonadIO m => Elem -> QuerySelector -> m [Elem] Source
Get all children elements matching a query selector.
elemsByClass :: MonadIO m => ElemClass -> m [Elem] Source
Get all elements of the given class.
setAttr :: MonadIO m => Elem -> PropID -> String -> m () Source
Set an attribute of the given element.
setProp' :: MonadIO m => Elem -> JSString -> JSString -> m () Source
Set a property of the given element, JSString edition.
getProp' :: MonadIO m => Elem -> JSString -> m JSString Source
Get a property of an element, JSString edition.
getValue :: (MonadIO m, JSType a) => Elem -> m (Maybe a) Source
Get the value property of an element; a handy shortcut.
withElems :: MonadIO m => [ElemID] -> ([Elem] -> m a) -> m a Source
Perform an IO action over several elements. Throws an error if some of the elements are not found.
withElemsQS :: MonadIO m => Elem -> QuerySelector -> ([Elem] -> m a) -> m a Source
Perform an IO action over the a list of elements matching a query selector.
mapQS :: MonadIO m => Elem -> QuerySelector -> (Elem -> m a) -> m [a] Source
Map an IO computation over the list of elements matching a query selector.
mapQS_ :: MonadIO m => Elem -> QuerySelector -> (Elem -> m a) -> m () Source
Like mapQS
but returns no value.
addChild :: MonadIO m => Elem -> Elem -> m () Source
Append the first element as a child of the second element.
addChildBefore :: MonadIO m => Elem -> Elem -> Elem -> m () Source
Insert the first element as a child into the second, before the third.
For instance:
addChildBefore childToAdd theContainer olderChild
removeChild :: MonadIO m => Elem -> Elem -> m () Source
Remove the first element from the second's children.
clearChildren :: MonadIO m => Elem -> m () Source
Remove all children from the given element.
getChildBefore :: MonadIO m => Elem -> m (Maybe Elem) Source
Get the sibling before the given one, if any.
getChildren :: MonadIO m => Elem -> m [Elem] Source
Get a list of all children belonging to a certain element.
setChildren :: MonadIO m => Elem -> [Elem] -> m () Source
Clear the given element's list of children, and append all given children to it.
setStyle :: MonadIO m => Elem -> PropID -> String -> m () Source
Set a CSS style property on an element.
getStyle' :: MonadIO m => Elem -> JSString -> m JSString Source
Get a CSS style property of an element, JSString style.
setStyle' :: MonadIO m => Elem -> JSString -> JSString -> m () Source
Set a CSS style property on an element, JSString style.
getFileData :: MonadIO m => Elem -> Int -> m (Maybe Blob) Source
Get a file from a file input element.
getFileName :: MonadIO m => Elem -> m String Source
Get the name of the currently selected file from a file input element. Any directory information is stripped, and only the actual file name is returned, as the directory information is useless (and faked) anyway.
setClass :: MonadIO m => Elem -> String -> Bool -> m () Source
Add or remove a class from an element's class list.
toggleClass :: MonadIO m => Elem -> String -> m () Source
Toggle the existence of a class within an elements class list.
hasClass :: MonadIO m => Elem -> String -> m Bool Source
Does the given element have a particular class?
The DOM node corresponding to document.body.