Element

Html. Element

A class to render the opening tag of HTML elements (as well as empty tags) with a set of attributes / values specified in the provided object
Members

Methods

Constructor

new Element(element, obj) → {object}

Parameters
Name Type Description
element string The name of the tag
obj object An object with keys / values to be applied to the HTML element
Returns
The class instance to allow method chaining
Type
object

Methods

(static) get(close) → {string}

Gets the opening tag (whitout inner html), optionally adding the self-closing token
Parameters
Name Type Description
close bool Closes the opening tag if true, otherwise leaves it open (in this case the content and the closing tags will be added in a second time or by another function)
Returns
Returns the HTML element as text/html
Type
string

(static) html(html) → {string}

Inserts a content inside the element and returns it as text/html
Parameters
Name Type Description
html string Inner html
Returns
The element as text/html
Type
string