Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

dom

A little library to manipulate the dom

parse

jstiller.components.dom.parse('<div><p>text</p></div><button>button</button>');

insert

element

var existingNode = jstiller.components.dom.find('body').firstChild,
    newNode = jstiller.components.dom.create.element('div');

jstiller.components.dom.insert.element(newNode).before(existingNode);
var existingNode = jstiller.components.dom.find('body').firstChild,
    newNode = jstiller.components.dom.create.element('div');

jstiller.components.dom.insert.element(newNode).after(existingNode);
var existingNode = jstiller.components.dom.find('body').firstChild,
    newNode = jstiller.components.dom.create.element('div');

jstiller.components.dom.insert.element(newNode).into(existingNode);

className

var existingNode = jstiller.components.dom.create.element('div');

jstiller.components.dom.insert.className('class').to(existingNode);

text

var existingNode = jstiller.components.dom.create.element('div');

jstiller.components.dom.insert.text('text ...').before(existingNode);
var existingNode = jstiller.components.dom.create.element('div');

jstiller.components.dom.insert.text('text ...').after(existingNode);
var existingNode = jstiller.components.dom.create.element('div');

jstiller.components.dom.insert.text('text ...').into(existingNode);

replace

element

var mainNode = jstiller.components.dom.find('main'),
  newMainNode = jstiller.components.dom.find('main');

jstiller.components.dom.replace.element(mainNode).by(newMainNode);

text

var mainNode = jstiller.components.dom.find('main');

jstiller.components.dom.replace.text('text ...').of(mainNode);

remove

element

var mainNode = jstiller.components.dom.find('main');
jstiller.components.dom.remove.element(mainNode);

className

var mainNode = jstiller.components.dom.find('main');
jstiller.components.dom.remove.className('class').from(mainNode);

create

element

var mainNode = jstiller.components.dom.create.element('div', {
  align: 'left'
});

find

var mainNode = jstiller.components.dom.find('main');
var mainNode = jstiller.components.dom.find('main', {
  quantity: 'all'
});
var mainNode = jstiller.components.dom.find('main', {
  context: document,
});
var mainNode = jstiller.components.dom.find('main', {
  quantity: 'one',
  context: document,
});

About

A little library to manipulate the dom

Topics

Resources

License

Packages

No packages published