Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including sypent with all npm packages installed. Try it out:

var sypent = require("sypent")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

sypent v1.0.0

Ultra-light JS DOM creation library

sypent logo

Ultra-light JS DOM manipulation library

GitHub | NPM


npm i sypent

And 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.


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, ?Array[HTMLElement | 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: []

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free