Add a class to the element. Takes care of not adding the same class if the element already has it.
Adds the element to the children of the current element
The element to append
Determine if an element support a particular native DOM event.
The event to evaluate. Eg: touchstart, touchend, click, scroll.
Return all children
Clone the node
true if the children of the node should also be cloned, or false to clone only the specified node.
Get the first element that matches the classname by testing the element itself and traversing up through its ancestors in the DOM tree.
Stops at the body of the document
A CSS classname
Get the css value of the specified property.
The property
Detach the element from the DOM.
Empty (remove all child) from the element;
Find a child element, given a CSS selector
A CSS selector, can be a .className or #id
Find all children that match the given CSS selector
A CSS selector, can be a .className
Find the child elements using a className
Class of the childs elements to find
Find an element using an ID
ID of the element to find
Focuses on an element.
Whether or not to scroll the page to the focused element.
Returns the value of the specified attribute.
The name of the attribute
Return an array with all the classname on the element. Empty array if the element has not classname
Check if the element has the given class name
Classname to verify
Returns the offset height of the element
Hide the element;
Insert the current node after the given reference node
Insert the current node before the given reference node
Check if the element match the selector.
The selector can be a class, an id or a tag.
Eg : .is('.foo') or .is('#foo') or .is('div').
Check if the element is a descendant of parent
Check if the element is "empty" (has no innerHTML content). Whitespace is considered empty
Check if the element is not a locked node ({ toString(): string }
) and thus have base element properties.
Tries to determine if an element is "visible", in a generic manner.
This is not meant to be a "foolproof" method, but only a superficial "best effort" detection is performed.
Remove an event handler on the element. Accepts either one (a string) or multiple (Array
The {string} or {Array
The function to remove on the element
Return the position relative to the document.
Returns the offset parent. The offset parent is the closest parent that is positioned. An element is positioned when its position property is not 'static', which is the default.
Bind an event handler on the element. Accepts either one (a string) or multiple (Array
The {string} or {Array
The function to execute when the event is triggered
Bind an event handler on the element. Accepts either one (a string) or multiple (Array
The event handler will execute only ONE time.
The {string} or {Array
The function to execute when the event is triggered
Get the first element that matches the classname by testing the element itself and traversing up through its ancestors in the DOM tree.
Stops at the body of the document
Get all the ancestors of the current element that match the given className
Return an empty array if none found.
Return the position relative to the offset parent.
Insert the given node as the first child of the current node
Empty the element and all childs from the dom;
Remove the class on the element. Works even if the element does not possess the class.
Classname to remove on the the element
Replace the current element with the other element, then detach the current element
Sets the value of the specified attribute.
The name of the attribute
The value to set
Sets the inner html of the element
The html to set
Show the element by setting display to block;
Return all siblings
Get or set the text content of the HTMLElement.
Optional. If given, this will set the text content of the element. If not, will return the text content.
Toggle the element visibility.
Optional visible parameter, if specified will set the element visibility
Optional parameter to display or hide the element
Toggle the class on the element.
Classname to toggle
If true, add the class regardless and if false, remove the class
Trigger an event on the element.
The event type to trigger
Show the element by setting display to an empty string.
Returns the offset width of the element
Helper function to quickly create an HTMLElement
The type of the element (e.g. div, span)
The props (id, className, attributes) of the element
Can be either specified in dashed-case strings ('my-attribute') or camelCased keys (myAttribute),
the latter of which will automatically get replaced to dash-case.
Performant way to transform a NodeList to an array of HTMLElement, for manipulation
http://jsperf.com/nodelist-to-array/72
a {NodeList} to convert to an array
Whether to always register, remove, and trigger events using standard JavaScript rather than attempting to use jQuery first.
Create a new Dom object with the given HTMLElement
The HTMLElement to wrap in a Dom object
This is essentially a helper class for dom manipulation.
This is intended to provide some basic functionality normally offered by jQuery.
To minimize the multiple jQuery conflict we have while integrating in various system, we implemented the very small subset that the framework needs.
See $$, which is a function that wraps this class constructor, for less verbose code.