Class: SmartDomElement_

SmartDomElement_(props)

base class of smartdom wrapper

Constructor

new SmartDomElement_(props)

Parameters:
Name Type Description
props object props
Source:

Methods

a(…childs)

append childs
Parameters:
Name Type Attributes Description
childs any <repeatable>
child elements, either single elements or arrays of elements
Source:
Example
div().a(
 div().html("Single div appended."),
 [
     div().html("Div appended as array element 0."),
     div().html("Div appended as array element 1."),
 ]
)

ac(classes)

add classes
Parameters:
Name Type Description
classes string space separated list of classes
Source:

addStyle(name, value)

add style and return the instance
Parameters:
Name Type Description
name string style name
value string style value
Source:

ae(events, callback)

add event listeners with a callback
Parameters:
Name Type Description
events string events separated by space
callback function callback
Source:

bc(x)

set background-color
Parameters:
Name Type Description
x string background color
Source:

build()

build element from scratch, should be implemented by derived classes
Source:

c(x)

set color
Parameters:
Name Type Description
x string color
Source:

disp(x)

set display
Parameters:
Name Type Description
x string display
Source:

dispi()

display initial
Source:

dispn()

display none
Source:

getAttribute(name)

get HTML element attribute
Parameters:
Name Type Description
name string name
Source:

h(x)

set height
Parameters:
Name Type Description
x number height in pixels
Source:

html(x)

set inner html
Parameters:
Name Type Description
x string HTML string
Source:

initState()

initialize state from props, should be implemented by derived classes
Source:

mount()

mount element
Source:

mountChilds()

mount childs of the element
Source:

pad(x)

set padding
Parameters:
Name Type Description
x number padding in pixels
Source:

path()

path to the element
Source:

pathId()

the id used as a path element
Source:

pathList()

list of path ids leading to the element
Source:

poa()

position absolute
Source:

por()

position relative
Source:

pos(x)

set position
Parameters:
Name Type Description
x string position
Source:

rc(classes)

remove classes
Parameters:
Name Type Description
classes string space separated list of classes
Source:

retrieveState()

retrieve the element state from localStorage if it has a path
Source:

setAttribute(name, value)

set HTML element attribute
Parameters:
Name Type Description
name string name
value any value
Source:

setValue(value)

set element value
Parameters:
Name Type Description
value any value
Source:

storePath()

store path of the element, by default it is the element path, but this can be overridden with props.forceStorePath
Source:

storeState()

store the element state in localStorage if it has a path
Source:

value()

return element value
Source:

w(x)

set width
Parameters:
Name Type Description
x number width in pixels
Source:

x()

delete content of element
Source: