1.0.0 • Published 8 years ago
sypent v1.0.0
Ultra-light JS DOM manipulation library
Install
npm i sypentAnd include the library.
<script src="sypent.min.js"></script>Why sypent?
sypent is awesome because it's simple and so useful.
It's also very lightweight. Like <0.5K unminified lightweight.
Usage
Let's create a div with class 'message' with a text node child.
let addDiv = sy('div', {'class': 'message'}, ['This is a text node.'])Now let's create a p tag with text nested inside of a div.
let complex = sy('div', {}, [
sy('p', {}, ['Hey there.'])
])In detail
sy(String tagName, ?Object attributes, ?ArrayHTMLElement | String | DocumentFragment children)
tagName - Tag of generated element.
optional attributes - Attributes for generated element. Default: {}
optional children - Children (elements) of generated element. May also contain strings, which will be made into text nodes. Default: []
1.0.0
8 years ago