vanilla-juice

1.0.2 • Public • Published

Juice

Juice lets you handle DOM operations a little more easily with vanilla.js. It creates three functions: createElementWithAttrs, setAttributes and appendChildren.


Installation

npm install vanilla-juice

Example

// Creates a div element with as many attributes as you want
var container = juice.createElementWithAttrs('div', {
	'class': 'container',
	'name': 'my-container',
};

// Lets you set any number of attributes to a DOM element
var otherContainer = juice.setAttributes(container, {
	'class': 'other-container',
	'name': 'my-other-container',
});

// Also lets you append any number of children elements to a container element
// You first define a container element where the children will be appended
var parent = juice.appendChildren(container);
// And then attach to that element all the children you want
parent(child1, child2, child3);

Readme

Keywords

none

Package Sidebar

Install

npm i vanilla-juice

Weekly Downloads

4

Version

1.0.2

License

MIT

Last publish

Collaborators

  • keyserfaty