fay-hsx-0.2.0: Clientside HTML generation for fay.

Safe HaskellNone

HTML

Description

A simple library for client-side HTML generation. Compatible with hsx2hs.

Synopsis

Documentation

data Attr a b Source

Constructors

a := b 

Instances

class AsChild a Source

type class for embedding values as HTML children

since Fay does not yet support type-class methods we have to fake it via the ffi

Instances

class AsAttr a Source

Instances

data HTML Source

ADT for HTML

Constructors

Element String [(String, String)] [HTML]

Element name attributes children

CDATA Bool String

CDATA needEscaping value

Instances

genElementSource

Arguments

:: (Maybe String, String)

Element name

-> [Fay (String, String)]

list of attributes

-> [Fay HTML]

list of children

-> Fay HTML 

generate an HTML element

renderHTML :: HTML -> Fay JQuerySource

render the HTML into a JQuery DOM tree. You still need to append the result somewhere.

NOTE: This function requires jQuery

alert :: String -> Fay ()Source

Alert using window.alert.

trSource

Arguments

:: [Fay (String, String)]

attributes

-> [Fay HTML]

children

-> Fay HTML 

<tr>

tdSource

Arguments

:: [Fay (String, String)]

attributes

-> [Fay HTML]

children

-> Fay HTML 

<td>

span_Source

Arguments

:: [Fay (String, String)]

attributes

-> [Fay HTML]

children

-> Fay HTML 

<span>

pcdata :: String -> Fay HTMLSource

create a text node from the String. The String will be automatically escaped.

createElementSource

Arguments

:: String

name of the element

-> Fay Element 

create a new Element

createTextNodeSource

Arguments

:: String

text to insert in the node

-> Fay Element 

create a new text node

NOTE: this doesn't really return an Element. It returns a TextNode or something. But fay-jquery only supports the Element type...