Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
@mapbox/query-selector-contains-node
Advanced tools
Changelog
1.0.0
Readme
Check whether a DOM node is contained by any other node on the page matching a selector, or matches the selector itself.
npm install @mapbox/query-selector-contains-node
This package provides a CommonJS module, so you'll need to be using a bundler (Webpack, Rollup, Browserify, etc.).
querySelectorContainsElement(selector, node)
Returns true
if any of the node
's ancestors match the selector
.
Also returns true
if the node
itself matches the selector
.
Otherwise, returns false
.
Type: string
.
Required.
A CSS selector suitable for document.querySelectorAll()
.
Type: Node
.
Required.
Given the following HTML:
<div>
<div id="one" foo>
<div>
<div id="two"></div>
</div>
</div>
<div id="three"></div>
</div>
Then:
querySelectorContainsElement('[foo]', document.getElementById('one')); // true
querySelectorContainsElement('[foo]', document.getElementById('two')); // true
querySelectorContainsElement('[foo]', document.getElementById('three')); // false
Browser support is determined by support for document.querySelectorAll()
.
So: IE 8 with caveats, otherwise IE 9+.
FAQs
Check whether a node is contained by any other node on the page matching a selector
The npm package @mapbox/query-selector-contains-node receives a total of 327 weekly downloads. As such, @mapbox/query-selector-contains-node popularity was classified as not popular.
We found that @mapbox/query-selector-contains-node demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 165 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.