Methods
attr(name, valueopt)
Set or get attribute of an element
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | Name of the attribute | |
value |
string |
<optional> |
Value of the attribute |
empty(elementopt)
Clear node
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
element |
element |
<optional> |
Optional element to clear. Otherwise current execution context will be used. |
find(selector, all) → {element|array|undefined}
Finds child element matching provided selector
Parameters:
Name | Type | Description |
---|---|---|
selector |
string | Selector has limitations based on the browser support. |
all |
boolean | Flag to find all matching elements. Otherwise fist found element is returned. |
Returns:
- Found element or array of elements
- Type
- element | array | undefined
fire(name, paramsopt) → {object}
Fire an event
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | Event name to fire | |
params |
object |
<optional> |
Details to attach |
Returns:
- Returns created event
- Type
- object
html(stropt)
Get the HTML contents of the element or set the HTML contents
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
str |
string |
<optional> |
HTML contents |
listen(name, fn)
Add event listener
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Name of the event to handle |
fn |
function | Event handler |
parse(html, tagopt)
Creates a new HTMLElement with provided contents
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
html |
string | HTML contents | |
tag |
string |
<optional> |
Optional tag of the element to create |