A small JavaScript DOM. Implements DOM level 1, with textContent from level 3
and innerHTML and outerHTML getters. Only supports HTML documents.
var minidom = require("minidom");
var document = minidom('<html><head><title>Hello</title><body><h1>Hi!</h1></body></html>');
document.getElementsByTagName("h1")[0].textContent === "Hi!"; // trueProperties marked ⃠ are read-only
ELEMENT_NODEATTRIBUTE_NODETEXT_NODECDATA_SECTION_NODEENTITY_REFERENCE_NODEENTITY_NODEPROCESSING_INSTRUCTION_NODECOMMENT_NODEDOCUMENT_NODEDOCUMENT_TYPE_NODEDOCUMENT_FRAGMENT_NODENOTATION_NODEchildren⃠nodeValueparentNode⃠nodeName⃠attributes⃠firstChild⃠ownerDocument⃠readonly⃠lastChild⃠childNodes⃠nextSibling⃠previousSibling⃠insertBefore(/* Node */ newChild, /* Node*/ refChild)replaceChild(/* Node */ newChild, /* Node */ oldChild)removeChild(/* Node */ oldChild)appendChild(/* Node */ newChild)hasChildNodes()cloneNode(/* bool */ deep, fn)normalize()toString()raise(type, message, data)textContent
nodeTypecontentType⃠doctypedocumentElement⃠implementationnodeName⃠tagName⃠nodeValueattributes⃠ownerDocument⃠readonly⃠createElement(/* string */ tagName)createDocumentFragment()createTextNode(/* string */ data)createComment(/* string */ data)createCDATASection(/* string */ data)createProcessingInstruction(/* string */ target, /* string */ data)createAttribute(/* string */ name)createEntityReference(/* string */ name)createEntityNode(/* string */ name)createNotationNode(/* string */ name, /* string */ publicId, /* string */ systemId)appendChild(/* Node */ arg)removeChild(/* Node */ arg)getElementsByTagName(/* string */ name)outerHTML⃠
nodeValuetagName⃠nodeTypeattributes⃠getAttribute(/* string */ name)setAttribute(/* string */ name, /* string */ value)removeAttribute(/* string */ name)getAttributeNode(/* string */ name)setAttributeNode(/* Attr */ newAttr)removeAttributeNode(/* Attr */ oldAttr)getElementsByTagName(/* string */ name)outerHTML⃠innerHTML⃠
Made possible with large excerpts from JSDom.
MIT license. See LICENSE.md for details.