mixin Node-Attributes
source: document/Node-Attributes.js, line 1
Extends Node
with utility attribute getters.
Details:
- See:
Methods
attr(name) → {String}
- static
source: document/Node-Attributes.js, line 20
Gets the value for the given attribute name.
Parameters
-
name
{String}
:attribute name
Returns
-
{String}
:value
Example
//<movie tags="sci-fi, horror, adventures" />
$movie.attr('tags')
// => "sci-fi, horror, adventures"
get(name, [opt]) → {String}
- static
source: document/Node-Attributes.js, line 35
This method is like attr
but will use an attribute parser if there is
one predefined for the given attribute name.
Parameters
-
name
{String}
:attribute name
-
[opt]
{Object}
:options to pass into attribute parser
Returns
-
{String}
:value
has(name) → {Boolean}
- static
source: document/Node-Attributes.js, line 51
Checks if node has or not an attribute with the given name
Parameters
-
name
{String}
:attribute name
Returns
-
{Boolean}
dsv(name, [delimiter]) → {Array.<String>}
- static
source: document/Node-Attributes.js, line 66
Gets Delimiter Separated Value An utility method converts given attribute value into dsv array
Parameters
-
name
{String}
:the name of the attribute
-
[delimiter]
{String}
:delimiter string
Returns
-
{Array.<String>}
Example
//<movie tags="sci-fi, horror, adventures">
$movie.dsv('tags',',')
// => ["sci-fi", "horror", "adventures"]