Research
Security News
Malicious PyPI Package ‘pycord-self’ Targets Discord Developers with Token Theft and Backdoor Exploit
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
element-qsa-scope
Advanced tools
Return elements matching a selector relative to the current node
Element QSA Scope lets you select elements relative to the current node. It
is a polyfill for :scope
support within the selector methods
Element#querySelector
, Element#querySelectorAll
, Element#matches
,
and Element#closest
.
npm install element-qsa-scope
The entire script is 341 bytes when minified and gzipped.
By default, selector methods return elements matching CSS selectors absolutely
from the document, similar to an element being matched with Element#matches
.
Imagine the following document:
<ul>
<li><a>Link</a>
<ul>
<li><a>Sublink</a></li>
</ul>
</li>
</ul>
<script>li = document.querySelector('li')</script>
Without :scope
, the following selector will return the first link.
li.querySelector('li a'); // returns <a>Link</a>
This is an example of how scoping is useful when traversing the DOM.
li.querySelector(':scope li a'); // returns <a>Sublink</a>
Browser | Native Support | Polyfill Support |
---|---|---|
Android | 4.4+ | 2.2 - 4.2 |
Blackberry | ✘ | 7+ |
Chrome | 27+ | 4 - 26 |
Edge | ✘ | 12+ |
Firefox | 32+ | 3.5 - 31 |
Internet Explorer | ✘ | 8 - 11 |
Opera | 15+ | 10 - 14 |
Opera Mini | ✘ | 5+ |
Safari (iOS) | 7+ | 3.2 - 6 |
Safari (MacOS) | 6.2+ | 4 - 6 |
Additional tests were run against the latest 3 versions of browsers, including common outliers such as Internet Explorer 8+ and Safari 6+.
FAQs
Return elements matching a selector relative to the current node
We found that element-qsa-scope demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.