endom
v1.1.1
Published
Import objects directly from the main package, e.g.: ```javascript const document = require('endom').document; ``` or ```javascript import { Element } from 'endom'; ```
Downloads
6
Readme
endom
Import objects directly from the main package, e.g.:
const document = require('endom').document;
or
import { Element } from 'endom';
Create globals
require('endom/register')
Example
require('endom/register')
const h1=document.createElement('h1');
h1.setAttribute('n', 'v');
h1.style.setProperty('color','red');
h1.innerHTML = 'w0f w0f';
h1.classList.add('cls');
console.log(h1.outerHTML);
Supported methods
- createElement(nodeName)
- createTextNode(value)
- appendChild(node)
- replaceChild(node)
- removeChild(node)
- insertBefore(new, existing)
- toString()
- setAttribute(name, value)
- getAttribute(name)
- setProperty(name, value)
- getProperty(name)
- innerHTML()
- outerHTML()
- textContent()
Setters update existing objects, otherwise create anew;
Properties
- innerHTML
- outerHTML
- textContent
- attribute.value
- attribute.name
- everything else
Credits
This project was forked from html-element, written by 1N50MN14 and contributors.