Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

element-qsa-scope

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

element-qsa-scope

Return elements matching a selector relative to the current node

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15K
increased by86.88%
Maintainers
1
Weekly downloads
 
Created
Source

QSA Scope

Return elements matching a selector relative to the current node

NPM Version Build Status Licensing Changelog Gitter Chat

QSA Scope is a polyfill for :scope support within QSA methods (#Element.querySelector and #Element.querySelectorAll).

<ul>
    <li><a>Link</a>
        <ul>
            <li><a>Sublink</a></li>
        </ul>
    </li>
</ul>
<script>
li = document.querySelector('ul li')
</script>

By default, QSA methods return any element matching the CSS selector absolutely, similar to the element being matched by #Element.matches.

li.querySelector('li a'); // returns <a>Link</a> due to it technically matching

Adding scope is especially useful when traversing the DOM.

li.querySelector(':scope li a'); // returns <a>Sublink</a> due to its context

Browser compatibility

BrowserNative SupportPolyfill Support
Android2.2+
Blackberry7+
Chrome27+4 - 26
Edge12+
Firefox32+3.5 - 31
Internet Explorer8 - 11
Opera15+10 - 14
Opera Mini5+
Safari (iOS)3.2 - 8.4
Safari (MacOS)6.2+4 - 6

Test Results

Additional tests were run against the latest 3 versions of browsers, including common outliers such as Internet Explorer 8+ and Safari 6+.

Native Support Polyfilled Support

Keywords

FAQs

Package last updated on 13 Oct 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc