Gathering detailed insights and metrics for dom4-elements
Gathering detailed insights and metrics for dom4-elements
Gathering detailed insights and metrics for dom4-elements
Gathering detailed insights and metrics for dom4-elements
A polyfill for the Elements class in recently added to the DOM Standard, as well as .query and .queryAll methods for Elements, Element, Document, and DocumentFragment.
npm install dom4-elements
Typescript
Module System
NPM Version
67.3
Supply Chain
98.6
Quality
74.9
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
118 Stars
34 Commits
4 Forks
10 Watchers
2 Branches
3 Contributors
Updated on Nov 19, 2023
Latest Version
0.0.2
Package Id
dom4-elements@0.0.2
Size
2.98 kB
NPM Version
1.3.8
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
DOM4 Elements is a polyfill that allows you to use the new .query
and .queryAll
methods newly added to DOM Level 4. queryAll
returns an instance of the new
Elements class which extends Array, allowing you to use map, reduce, filter,
forEach, and the like on the returned elements.
DOM 4 added query and queryAll methods to the ParentNode interface, which is implemented by Document, Element, and DocumentFragment. It also defined a new class, Elements, which extends Array and also has query and queryAll.
You can install the dom4-elements
package with either npm or bower, or directly
download dom4-elements.js or dom4-elements.min.js and include them in your project.
bower install dom4-elements
or
npm install dom4-elements
You are also welcome to clone the repo directly and use the dom4-elements.js or
dom4-elements.min.js in the lib
directory.
git clone https://github.com/barberboy/dom4-elements
make init
make build
.query()
is available on document, documentFragments, individual DOM elements, and
the Elements class. It will return the first descendant element which matches the
selector, or null if there isn't one that matches.
var siteHeader = document.query('header');
var active = siteHeader.query('.site-menu .active');
.queryAll is available on document, documentFragments, individual DOM elements and the Elements class. It will return an instance of Elements that contains descendants that match the passed selector, or an instance with no elements if there are no matches.
var collapsible = document.queryAll('.collapsible');
collapsible.forEach(function(section){
var heading = section.query('h1,h2,h3,h4,h5,h6');
heading.addEventListener('click', function(event) {
section.classList.toggle('collapsed');
}, false);
});
// .query and .queryAll are available on the Elements array as well.
var sections = document.queryAll('section');
var headingLinks = sections.queryAll(':any(h1,h2,h3,h4,h5,h6) a');
The Elements class is a subclass of Array that holds DOM elements. It isn't used directly, but is returned by the .queryAll methods on document, element, and elements.
var sections = document.queryAll("section");
sections.forEach(function(section){
// Do something with each section
section.classList.add('visible');
section.query('h3').classList.add('visible-heading');
});
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 2/26 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More