@lumjs/dom
v1.4.0
Published
A small set of DOM helpers wrapped in a minimalist core.
Downloads
3
Readme
lum.dom.js
A small set of DOM helpers wrapped in a minimalist core.
Features
- Wraps a
window
object so it works in browser or Node.js withjsdom
. - Has a bunch of simple type tests.
- Simple method wrappers for common functionality:
dom.elem()
→document.createElement()
dom.frag()
→document.createDocumentFragment()
dom.parse()
→(new DOMParser()).parseFromString()
dom.html()
→ Usedom.parse()
forcing HTML, and return the element(s). Can optionally rundom.extend()
on the returned value automatically.dom.xml()
→ Usedom.parse()
forcing XML, and return the document element. Can optionally rundom.extend()
automatically.
- A
Query
library which extendsquerySelector
andquerySelectorAll
.- Use
dom.query
for access to a default library instance. - Has a
dom.find()
shortcut method to find multiple nodes. Can optionally return anHTMLCollection
instead of aNodeList
. - Has a
dom.get()
shortcut method to find a single node. - With
dom.options.extendQueries
set totrue
, results from either of the shortcut methods usedom.extend()
automatically.
- Use
- An
Events
library to make working with event handlers easier.- Supports building delegated event handlers automatically.
- Use
dom.events
for access to a default library instance. - Has
dom.on(), dom.off(), dom.trigger()
shortcut methods.
- An
Extender
library to add additional methods and accessor properties toNode
,NodeList
, orHTMLCollection
object instances.- Use
dom.extender
for access to a default library instance. - Has a
dom.extend()
shortcut method.
- Use
- A
ListCompiler
library for buildingNodeList
andHTMLCollection
objects, which normally cannot be constructed manually.- Use
dom.listCompiler
for access to a default library instance. - Used by the
Query
library to build composite lists, and to convertNodeList
results intoHTMLCollection
results when asked to. - Can be easily extended to add other DOM objects without constructors.
- Use
Official URLs
This library can be found in two places:
Author
Timothy Totten [email protected]