haste-compiler-0.2.99: Haskell To ECMAScript compiler

Safe HaskellNone

Haste.DOM

Synopsis

Documentation

newtype Elem Source

Constructors

Elem JSAny 

Instances

Marshal Elem 
BitmapSource Elem 
Sink Elem String

Set the sink element's innerHTML property whenever a new string comes down the pipe.

Sink Elem [IO Elem]

Same as the instance for [Elem].

Sink Elem [Elem]

Replace the sink element's list of child nodes whenever a new list of nodes comes down the pipe.

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.

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.