DOM
Dom manipulation module
- Source:
Methods
-
(static) addClass(class)
-
Adds a class to the element(s) specified by the current selector
Parameters:
Name Type Description class
string - Source:
-
(static) append(htm)
-
Adds to the innerHTML of the current element, after the last child.
Parameters:
Name Type Description htm
string - Source:
Example
$_("ul").dom.append("<li></li>"); // Adds an li element to the end of the selected ul element
-
(static) attr(name, valueopt, nullable) → (nullable) {string}
-
Sets attributes on element(s) specified by the current selector, or, if name is not specified, returns the value of the attribute of the element specified by the current selector.
Parameters:
Name Type Attributes Description name
string value
string <optional>
<nullable>
- Source:
Returns:
- Type
- string
-
(static) css(property, valueopt, nullable) → (nullable) {string}
-
Sets or retrieves a css property of the element specified by the current selector. If a value is passed, it will set that value on the current element, otherwise it will return the value of the css property on the current element. Accepts either key/value arguments, or an object with multiple key/value pairs.
Parameters:
Name Type Attributes Description property
string | Object value
string <optional>
<nullable>
- Source:
Returns:
- Type
- string
Examples
$_('#foo').dom.css('border', 0);
$_('#foo').dom.css({background:'#000', color:'#fff'});
-
(static) hide()
-
Hides the element(s) specified by the current selector
- Source:
-
(static) html(htmopt, nullable) → (nullable) {string}
-
Sets or gets the innerHTML propery of the element(s) passed
Parameters:
Name Type Attributes Description htm
string <optional>
<nullable>
- Source:
Returns:
- Type
- string
-
(static) prepend(htm)
-
Adds to the innerHTML of the selected element, before the current children
Parameters:
Name Type Description htm
string - Source:
Example
$_("ul").dom.append("<li></li>"); // Adds an li element to the beginning of the selected ul element
-
(static) removeClass(class)
-
Removes a class from the element(s) specified by the current selector
Parameters:
Name Type Description class
string - Source:
-
(static) show(typeopt)
-
Shows the element(s) specified by the current selector. if type is specified, the element will have it's style property set to "display:[your type]". If type is not specified, the element is set to "display:block".
Parameters:
Name Type Attributes Description type
string <optional>
- Source:
-
(static) text(valueopt, nullable) → (nullable) {string}
-
Sets or retrieves the text content of the element specified by the current selector. If a value is passed, it will set that value on the current element, otherwise it will return the value of the current element
Parameters:
Name Type Attributes Description value
string <optional>
<nullable>
- Source:
Returns:
- Type
- string