Class: Tag

low.Tag

Class representing a HTML tag tree node.

The setter methods of this class return the tag object itself, which allows for chaining multiple commands.

new low.Tag (t)

This constructor is not exported. Use the function low.tag to create a node instead.

Name Type Description
t string

The tag name.

See:

Methods

attr (key, value)low.Tag

Sets an attribute value.

Name Type Description
key string

The attribute key.

value string

The attribute value.

Returns:
Type Description
low.Tag This object for chaining further commands.

child (n)low.Tag

Returns the n-th child of the node.

Negative values for n may be used to count from the end of the list of children. For example, -1 returns the last child.

Name Type Description
n number

The number of the child.

Returns:
Type Description
low.Tag The n-th child node.

class (c)low.Tag

Adds a CSS class to the node. Multiple classes may be set by calling this method multiple times.

Name Type Description
c string

The class name.

Returns:
Type Description
low.Tag This object for chaining further commands.

content (c)low.Tag

Adds a child node.

Name Type Description
c low.Tag

The child node.

Returns:
Type Description
low.Tag This object for chaining further commands.

content (c)low.Tag

Adds content text on the node.

Name Type Description
c string

The content text.

Returns:
Type Description
low.Tag This object for chaining further commands.

data (name, value)low.Tag

Sets a data attribute.

Calling tag.data("role", "page") is the same as calling tag.attr("data-role", "page").

Name Type Description
name string

The data attribute name.

value string

The data attribute value.

Returns:
Type Description
low.Tag This object for chaining further commands.

html ()string

Creates the HTML code representation of the tag node tree. Use with low.createElementTree for creating a DOM node tree.

Returns:
Type Description
string The HTML code.

Sets the HTML ID value. HTML IDs must be unique within a document.

Name Type Description
id string

The ID value.

Returns:
Type Description
low.Tag This object for chaining further commands.

on (ev, handler)low.Tag

Sets a DOM event handler.

Name Type Description
ev string

The event name, e.g. click.

handler string

The event callback as string.

Returns:
Type Description
low.Tag This object for chaining further commands.

style (key, value)low.blobTag

Sets a CSS property.

Name Type Description
key string

The CSS property key.

value string

The CSS property value.

Returns:
Type Description
low.blobTag This object for chaining further commands.