domy-insert
Insert any data type to the DOM. For use with Browserify.
Part of the Domy module collection.
Install
npm install domy-insert --save
Usage
var insert = ; ;; var div = document;divclassName = 'another-element'; ; // inserted at end of document.body
Methods
insert(element)
element
- string OR DOM element to insert
Creates and returns an object with the following methods available:
before
after
beginnning
end
Instance Methods
before(sibling[, parent])
sibling
- string or object of element to insert beforeparent
- string or DOM element of context of insert. Defaults todocument.body
after(sibling[, parent])
sibling
- string or object of element to insert afterparent
- string or DOM element of context of insert. Defaults todocument.body
beginning([parent])
Insert an element at the beginning of the given parent's child node list
parent
- string or DOM element of context of insert. Defaults todocument.body
end([parent])
Works the same as insert(element, parent)
. Inserts element at the end of the given element context
parent
- string or DOM element of context of insert. Defaults todocument.body
Run Tests
npm install
npm test