create
static
DOM
create
(
tagName
,
[options]
)
A shortcut to create DOM Elements.
Note 1: for "class" attribute use
Note 2: for "style" use nested rules (e.g.
Note 1: for "class" attribute use
className
.Note 2: for "style" use nested rules (e.g.
{style: {border: "1px solid red", color: "#de45ff"}}
)
- Parameters:
-
tagName <String>
the name of a DOM Object (e.g 'div') -
[options] <JSON>
set of attributes
- Returns:
DOM
getElementsByAttribute
static
Array<DOM>
getElementsByAttribute
(
attribute
,
value
)
Returns an Array of DOM objects that match exactly the same value for the given attribute name.
For "class" attribute it chekcs for a class among the defined ones. Example: <input type="text" class="className1 className2" /> is found even using jsbeans.dom.getElementsByAttribute("class", "className1").
Note: this kind of functionality is now widely supported by almost all javascript libraries. It probably won't be deleted, but checking its presence after an update is encouraged.
For "class" attribute it chekcs for a class among the defined ones. Example: <input type="text" class="className1 className2" /> is found even using jsbeans.dom.getElementsByAttribute("class", "className1").
Note: this kind of functionality is now widely supported by almost all javascript libraries. It probably won't be deleted, but checking its presence after an update is encouraged.
- Parameters:
-
attribute <String>
the attribute name of a DOM Object -
value <String>
the attribute value to match
- Returns:
Array<DOM>
insertAfter
static
void
insertAfter
(
base_object
,
object_to_append
)
Appends {@param}
Note that no check will be performed on given arguments. Passing DOM Object is up to developer.
object_to_append
at the same level of {@param} base_object
, just after it.Note that no check will be performed on given arguments. Passing DOM Object is up to developer.
- Parameters:
-
base_object <DOM>
ifnull
orundefined
document.firstChild
will be used. -
object_to_append <DOM>
- Returns:
void
moveDown
static
void
moveDown
(
object_to_move
)
Switches {@param}
Note that no check will be performed on given arguments. Passing DOM Object is up to developer.
FIXME: it seems that cloning nodes makes some conflict with event handlers attached via javascript (i.e. jquery.mouseout(...))
object_to_move
with next sibling. Effect seems to move down given ObjectNote that no check will be performed on given arguments. Passing DOM Object is up to developer.
FIXME: it seems that cloning nodes makes some conflict with event handlers attached via javascript (i.e. jquery.mouseout(...))
- Parameters:
-
object_to_move <DOM>
ifnull
orundefined
the method will exit silently.
- Returns:
void
moveUp
static
void
moveUp
(
object_to_move
)
Switches {@param}
Note that no check will be performed on given arguments. Passing DOM Object is up to developer.
FIXME: it seems that cloning nodes makes some conflict with event handlers attached via javascript (i.e. jquery.mouseout(...))
object_to_move
with previous sibling. Effect seems to move up given ObjectNote that no check will be performed on given arguments. Passing DOM Object is up to developer.
FIXME: it seems that cloning nodes makes some conflict with event handlers attached via javascript (i.e. jquery.mouseout(...))
- Parameters:
-
object_to_move <DOM>
ifnull
orundefined
the method will exit silently.
- Returns:
void
removeSelf
static
void
removeSelf
(
object_to_remove
)
Removes {@param}
Note that no check will be performed on given arguments. Passing DOM Object is up to developer.
object_to_remove
. Useful to direct removing DOM Objects.Note that no check will be performed on given arguments. Passing DOM Object is up to developer.
- Parameters:
-
object_to_remove <DOM>
- Returns:
void
visit
static
void
visit
(
node
,
func
)
Starting from {@param}
Note that no check will be performed on given arguments. Passing DOM Object is up to developer.
node
this method will call {@param} func
on every next sibling recursively.Note that no check will be performed on given arguments. Passing DOM Object is up to developer.
- Parameters:
-
node <DOM>
-
func <Function>
- Returns:
void