1.4.0 • Published 2 years ago
@lumjs/dom v1.4.0
lum.dom.js
A small set of DOM helpers wrapped in a minimalist core.
Features
- Wraps a
windowobject 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
Querylibrary which extendsquerySelectorandquerySelectorAll.- Use
dom.queryfor access to a default library instance. - Has a
dom.find()shortcut method to find multiple nodes. Can optionally return anHTMLCollectioninstead of aNodeList. - Has a
dom.get()shortcut method to find a single node. - With
dom.options.extendQueriesset totrue, results from either of the shortcut methods usedom.extend()automatically.
- Use
- An
Eventslibrary to make working with event handlers easier.- Supports building delegated event handlers automatically.
- Use
dom.eventsfor access to a default library instance. - Has
dom.on(), dom.off(), dom.trigger()shortcut methods.
- An
Extenderlibrary to add additional methods and accessor properties toNode,NodeList, orHTMLCollectionobject instances.- Use
dom.extenderfor access to a default library instance. - Has a
dom.extend()shortcut method.
- Use
- A
ListCompilerlibrary for buildingNodeListandHTMLCollectionobjects, which normally cannot be constructed manually.- Use
dom.listCompilerfor access to a default library instance. - Used by the
Querylibrary to build composite lists, and to convertNodeListresults intoHTMLCollectionresults 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 2010@totten.ca