haste-compiler-0.4.2: Haskell To ECMAScript compiler

Safe HaskellNone

Haste.DOM

Synopsis

Documentation

newtype Elem Source

Constructors

Elem JSAny 

newElem :: MonadIO m => String -> m ElemSource

Create an element.

newTextElem :: MonadIO m => String -> m ElemSource

Create a text node.

elemById :: MonadIO m => ElemID -> m (Maybe Elem)Source

Get an element by its HTML ID attribute.

setProp :: MonadIO m => Elem -> PropID -> String -> m ()Source

Set a property of the given element.

getProp :: MonadIO m => Elem -> PropID -> m StringSource

Get a property of an element.

setAttr :: MonadIO m => Elem -> PropID -> String -> m ()Source

Set an attribute of the given element.

getAttr :: MonadIO m => Elem -> PropID -> m StringSource

Get an attribute of an element.

setProp' :: MonadIO m => Elem -> JSString -> JSString -> m ()Source

Set a property of the given element, JSString edition.

getProp' :: MonadIO m => Elem -> JSString -> m JSStringSource

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.

withElem :: MonadIO m => ElemID -> (Elem -> m a) -> m aSource

Perform an IO action on an element.

withElems :: MonadIO m => [ElemID] -> ([Elem] -> m a) -> m aSource

Perform an IO action over several elements. Throws an error if some of the elements are not found.

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.

getFirstChild :: MonadIO m => Elem -> m (Maybe Elem)Source

Get the first of an element's children.

getLastChild :: MonadIO m => Elem -> m (Maybe Elem)Source

Get the last of an element's children.

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.

getStyle :: MonadIO m => Elem -> PropID -> m StringSource

Get a CSS style property of an element.

setStyle :: MonadIO m => Elem -> PropID -> String -> m ()Source

Set a CSS style property on an element.

getStyle' :: MonadIO m => Elem -> JSString -> m JSStringSource

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 StringSource

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 BoolSource

Does the given element have a particular class?

click :: MonadIO m => Elem -> m ()Source

Generate a click event on an element.

focus :: MonadIO m => Elem -> m ()Source

Generate a focus event on an element.

blur :: MonadIO m => Elem -> m ()Source

Generate a blur event on an element.

documentBody :: ElemSource

The DOM node corresponding to document.body.