dom-lite

A small DOM implementation

Usage no npm install needed!

<script type="module">
  import domLite from 'https://cdn.skypack.dev/dom-lite';
</script>

README

DOM lite – Build Coverage Size Buy Me A Tea

A small DOM implementation where most of DOM attributes and methods from document are implemented.

Examples

var document = require("dom-lite").document;

var el = document.createElement("h1");
el.id = 123;
el.className = "large";

var fragment = document.createDocumentFragment();
var text1 = document.createTextNode("hello");
var text2 = document.createTextNode(" world");

fragment.appendChild(text1);
fragment.appendChild(text2);
el.appendChild(fragment);

el.innerHTML;
// hello world
el.innerHTML = "<b>hello world</b>"
el.outerHTML;
// <h1 id="123" class="large"><b>hello world</b></h1>
el.querySelectorAll("b");
// [ "<b>hello world</b>" ]

External links

GitHub repo | npm package | DOM spec | Selectors Level 3 | Travis CI | Coveralls coverage
Coding Style Guidelines | Buy Me A Tea

Licence

Copyright (c) 2014-2020 Lauri Rooden <lauri@rooden.ee>
The MIT License