dom()

Creates HTML DOM objects.

This function is valid in v2.4.0 to v2.12.0. This function has been downloaded 10 times.

Parameter

{string|Object} input
The value that will be converted to DOM objects. If a string, it will be interpreted as raw HTML. Otherwise this must be an object specifying at least the nodeName (or _) property. To represent an element with child nodes you can set the children (or $) property to an input object, input string, or array of input strings and/or objects that will be recursively interpreted. The html property will be interpreted as the innerHTML property. The text property will be interpreted ass the innerText and textContent properties. The cls property will be interpreted as the element's class name.

Returns

{Array.<Node>|HTMLElement}
If input was a string an array of nodes represented in that string will be returned. Otherwise the element represented by input will be returned.

Required Functions

This function requires the following functions which are included automatically:

  • has()
    Every object descended from Object inherits the hasOwnProperty method. This method can be used to determine whether an object has the specified property as a direct property of that object; unlike the in operator, this method does not check down the object's prototype chain.
  • toArray()
    Turns anything into an array.
  • typeOf()
    Either gets the type of a value or adds a constructor registering its custom type name.