| Safe Haskell | None | 
|---|---|
| Language | Haskell98 | 
Haste.DOM
Description
DOM manipulation functions using String for string representation.
- data AttrName
 - data Attribute
 - class IsElem a where
 - newtype Elem = Elem JSAny
 - attribute :: AttrName -> JSString -> Attribute
 - set :: (IsElem e, MonadIO m) => e -> [Attribute] -> m ()
 - with :: (IsElem e, MonadIO m) => m e -> [Attribute] -> m e
 - children :: [Elem] -> Attribute
 - click :: (IsElem e, MonadIO m) => e -> m ()
 - focus :: (IsElem e, MonadIO m) => e -> m ()
 - blur :: (IsElem e, MonadIO m) => e -> m ()
 - document :: Elem
 - documentBody :: Elem
 - appendChild :: (IsElem parent, IsElem child, MonadIO m) => parent -> child -> m ()
 - addChild :: (IsElem parent, IsElem child, MonadIO m) => child -> parent -> m ()
 - addChildBefore :: (IsElem parent, IsElem child, MonadIO m) => child -> parent -> child -> m ()
 - insertChildBefore :: (IsElem parent, IsElem before, IsElem child, MonadIO m) => parent -> before -> child -> m ()
 - getFirstChild :: (IsElem e, MonadIO m) => e -> m (Maybe Elem)
 - getLastChild :: (IsElem e, MonadIO m) => e -> m (Maybe Elem)
 - getChildren :: (IsElem e, MonadIO m) => e -> m [Elem]
 - setChildren :: (IsElem parent, IsElem child, MonadIO m) => parent -> [child] -> m ()
 - clearChildren :: (IsElem e, MonadIO m) => e -> m ()
 - deleteChild :: (IsElem parent, IsElem child, MonadIO m) => parent -> child -> m ()
 - removeChild :: (IsElem parent, IsElem child, MonadIO m) => child -> parent -> m ()
 - type PropID = String
 - type ElemID = String
 - type QuerySelector = String
 - type ElemClass = String
 - type AttrValue = String
 - prop :: String -> AttrName
 - style :: String -> AttrName
 - attr :: String -> AttrName
 - (=:) :: 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 :: (IsElem e, MonadIO m) => e -> PropID -> String -> m ()
 - getProp :: (IsElem e, MonadIO m) => e -> PropID -> m String
 - setAttr :: (IsElem e, MonadIO m) => e -> PropID -> String -> m ()
 - getAttr :: (IsElem e, MonadIO m) => e -> PropID -> m String
 - getValue :: (IsElem e, MonadIO m, JSType a) => e -> m (Maybe a)
 - withElem :: MonadIO m => ElemID -> (Elem -> m a) -> m a
 - withElems :: MonadIO m => [ElemID] -> ([Elem] -> m a) -> m a
 - withElemsQS :: (IsElem e, MonadIO m) => e -> QuerySelector -> ([Elem] -> m a) -> m a
 - mapQS :: (IsElem e, MonadIO m) => e -> QuerySelector -> (Elem -> m a) -> m [a]
 - mapQS_ :: (IsElem e, MonadIO m) => e -> QuerySelector -> (Elem -> m a) -> m ()
 - getStyle :: (IsElem e, MonadIO m) => e -> PropID -> m String
 - setStyle :: (IsElem e, MonadIO m) => e -> PropID -> String -> m ()
 - getFileData :: (IsElem e, MonadIO m) => e -> Int -> m (Maybe Blob)
 - getFileName :: (IsElem e, MonadIO m) => e -> m String
 - setClass :: (IsElem e, MonadIO m) => e -> String -> Bool -> m ()
 - toggleClass :: (IsElem e, MonadIO m) => e -> String -> m ()
 - hasClass :: (IsElem e, MonadIO m) => e -> String -> m Bool
 
Documentation
The name of an attribute. May be either a common property, an HTML attribute or a style attribute.
A key/value pair representing the value of an attribute. May represent a property, an HTML attribute, a style attribute or a list of child elements.
The class of types backed by DOM elements.
Minimal complete definition
A DOM node.
set :: (IsElem e, MonadIO m) => e -> [Attribute] -> m () Source
Set a number of Attributes on an element.
with :: (IsElem e, MonadIO m) => m e -> [Attribute] -> m e Source
Set a number of Attributes on the element produced by an IO action.
   Gives more convenient syntax when creating elements:
newElem "div" `with` [
    style "border" =: "1px solid black",
    ...
  ]The DOM node corresponding to document.body.
appendChild :: (IsElem parent, IsElem child, MonadIO m) => parent -> child -> m () Source
Append the second element as a child of the first.
addChild :: (IsElem parent, IsElem child, MonadIO m) => child -> parent -> m () Source
Deprecated: Use appendChild instead. Note that appendChild == flip addChild.
Append the first element as a child of the second element.
addChildBefore :: (IsElem parent, IsElem child, MonadIO m) => child -> parent -> child -> m () Source
Deprecated: Use insertChildBefore instead. Note insertChildBefore == parent new old -> addChildBefore new parent old.
Insert an element into a container, before another element.
   For instance:
 
   addChildBefore childToAdd theContainer olderChild
 
insertChildBefore :: (IsElem parent, IsElem before, IsElem child, MonadIO m) => parent -> before -> child -> m () Source
Insert an element into a container, before another element.
   For instance:
 
   insertChildBefore theContainer olderChild childToAdd
 
getFirstChild :: (IsElem e, MonadIO m) => e -> m (Maybe Elem) Source
Get the first of an element's children.
getLastChild :: (IsElem e, MonadIO m) => e -> m (Maybe Elem) Source
Get the last of an element's children.
getChildren :: (IsElem e, MonadIO m) => e -> m [Elem] Source
Get a list of all children belonging to a certain element.
setChildren :: (IsElem parent, IsElem child, MonadIO m) => parent -> [child] -> m () Source
Clear the given element's list of children, and append all given children to it.
clearChildren :: (IsElem e, MonadIO m) => e -> m () Source
Remove all children from the given element.
deleteChild :: (IsElem parent, IsElem child, MonadIO m) => parent -> child -> m () Source
Remove the second element from the first's children.
removeChild :: (IsElem parent, IsElem child, MonadIO m) => child -> parent -> m () Source
Deprecated: Use deleteChild instead. Note that deleteChild = flip removeChild.
DEPRECATED: use deleteChild instead!
   Note that deleteChild = flip removeChild.
type QuerySelector = String Source
prop :: String -> AttrName Source
Create a DOM property name. See http://stackoverflow.com/questions/6003819/properties-and-attributes-in-html for more information about the difference between attributes and properties.
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.
setProp :: (IsElem e, MonadIO m) => e -> PropID -> String -> m () Source
Set a property of the given element.
setAttr :: (IsElem e, MonadIO m) => e -> PropID -> String -> m () Source
Set an attribute of the given element.
getValue :: (IsElem e, MonadIO m, JSType a) => e -> 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 :: (IsElem e, MonadIO m) => e -> QuerySelector -> ([Elem] -> m a) -> m a Source
Perform an IO action over the a list of elements matching a query selector.
mapQS :: (IsElem e, MonadIO m) => e -> QuerySelector -> (Elem -> m a) -> m [a] Source
Map an IO computation over the list of elements matching a query selector.
mapQS_ :: (IsElem e, MonadIO m) => e -> QuerySelector -> (Elem -> m a) -> m () Source
Like mapQS but returns no value.
getStyle :: (IsElem e, MonadIO m) => e -> PropID -> m String Source
Get a CSS style property of an element.
setStyle :: (IsElem e, MonadIO m) => e -> PropID -> String -> m () Source
Set a CSS style property on an element.
getFileData :: (IsElem e, MonadIO m) => e -> Int -> m (Maybe Blob) Source
Get a file from a file input element.
getFileName :: (IsElem e, MonadIO m) => e -> 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 :: (IsElem e, MonadIO m) => e -> String -> Bool -> m () Source
Add or remove a class from an element's class list.
toggleClass :: (IsElem e, MonadIO m) => e -> String -> m () Source
Toggle the existence of a class within an elements class list.