A minimalistic html parser supporting a subset of standard DOM APIs, just for the fun of it.
Features:
- Includes TypeScript typings.
- 2.7Kb minified/mangled/gzipped
- No dependencies
Usage
// Prints: strong "Hello there"console.logdom.tagName, dom.innerText
API
Just supports a limited version of the DOM
Functions:
parseHtml(str:string):Node[]
Classes behave like standard, see MDN docss:
Node
Element
tagName
atttributes
childNodes
CharacterData
textContent
innerText
Text
(inheritsCharacterData
)Comment
(inheritsCharacterData
)DocType
(inheritsCharacterData
)