Skip to content
This repository was archived by the owner on Dec 8, 2021. It is now read-only.

JStiller/dom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

Stars

Watchers

Forks

Packages

 
 
 

Contributors