tnt-dom
Super simple DOM library
Designed to be used with browserify.
Please note that this DOM library is not yet production ready. So for the moment: use at your own risk.
Getting started
Install using npm:
$ npm install tnt-dom
Add it to your Javascript:
var tnt = ;
Methods
constructor
// From HTML stringvar el = '<div class="my-class">My element</div>' ; // From selectorvar el = 'div.my-class' ; // From HTMLElementvar el = documentbody ;
forEach
element;
length
Gets the amount of matched elements
elementlength;
get
Gets a HTMLElement by index
element;
remove
Removes the element from the DOM.
element;
copy
Makes a new copy of the element(s)
element;
append
Append one or multiple elements to the current element
element;
or
element );
appendTo
Append the current element to an element
element;
insertBefore
Inserts the element(s) before an element
element;
wrap
Wrap the element(s) with an element
element;
css
Sets a CSS property to the element(s)
element;
addClass
Adds a class to the element(s)
element;
removeClass
Removes a class from the element(s)
element;