├── .editorconfig
├── .gitignore
├── .travis.yml
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE.md
├── README.md
├── index.js
└── package.json
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | end_of_line = lf
6 | indent_style = tab
7 | insert_final_newline = true
8 | trim_trailing_whitespace = true
9 |
10 | [*.md]
11 | trim_trailing_whitespace = false
12 |
13 | [*.{json,md,yml}]
14 | indent_size = 2
15 | indent_style = space
16 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | package-lock.json
3 | *.log*
4 | .*
5 | !.editorconfig
6 | !.gitignore
7 | !.rollup.js
8 | !.tape.js
9 | !.travis.yml
10 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - stable
4 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changes to Element QSA Scope
2 |
3 | ### 1.1.0 (July 5, 2018)
4 |
5 | - Polyfill `matches` and `closest`
6 |
7 | ### 1.0.1 (January 24, 2017)
8 |
9 | - Update project configuration
10 |
11 | ### 1.0.0 (October 13, 2016)
12 |
13 | - Initial release
14 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to Element QSA Scope
2 |
3 | You want to help? You rock! Now, take a moment to be sure your contributions
4 | make sense to everyone else.
5 |
6 | ## Reporting Issues
7 |
8 | Found a problem? Want a new feature?
9 |
10 | - See if your issue or idea has [already been reported].
11 | - Provide a [reduced test case] or a [live example].
12 |
13 | Remember, a bug is a _demonstrable problem_ caused by _our_ code.
14 |
15 | ## Submitting Pull Requests
16 |
17 | Pull requests are the greatest contributions, so be sure they are focused in
18 | scope and avoid unrelated commits.
19 |
20 | 1. To begin; [fork this project], clone your fork, and add our upstream.
21 | ```bash
22 | # Clone your fork of the repo into the current directory
23 | git clone git@github.com:YOUR_USER/element-qsa-scope.git
24 |
25 | # Navigate to the newly cloned directory
26 | cd element-qsa-scope
27 |
28 | # Assign the original repo to a remote called "upstream"
29 | git remote add upstream git@github.com:jonathantneal/element-qsa-scope.git
30 |
31 | # Install the tools necessary for testing
32 | npm install
33 | ```
34 |
35 | 2. Create a branch for your feature or fix:
36 | ```bash
37 | # Move into a new branch for your feature
38 | git checkout -b feature/thing
39 | ```
40 | ```bash
41 | # Move into a new branch for your fix
42 | git checkout -b fix/something
43 | ```
44 |
45 | 3. If your code follows our practices, then push your feature branch:
46 | ```bash
47 | # Test current code
48 | npm test
49 | ```
50 | ```bash
51 | # Push the branch for your new feature
52 | git push origin feature/thing
53 | ```
54 | ```bash
55 | # Or, push the branch for your update
56 | git push origin update/something
57 | ```
58 |
59 | That’s it! Now [open a pull request] with a clear title and description.
60 |
61 | [already been reported]: https://github.com/jonathantneal/create-postcss-plugin/issues
62 | [fork this project]: https://github.com/jonathantneal/create-postcss-plugin/fork
63 | [live example]: https://codepen.io/pen
64 | [open a pull request]: https://help.github.com/articles/using-pull-requests/
65 | [reduced test case]: https://css-tricks.com/reduced-test-cases/
66 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | # CC0 1.0 Universal License
2 |
3 | Public Domain Dedication
4 |
5 | The person(s) who associated a work with this deed has dedicated the work to the public domain by waiving all of his or her rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law.
6 |
7 | You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
8 |
9 | In no way are the patent or trademark rights of any person affected by CC0, nor are the rights that other persons may have in the work or in how the work is used, such as publicity or privacy rights.
10 |
11 | Unless expressly stated otherwise, the person(s) who associated a work with this deed makes no warranties about the work, and disclaims liability for all uses of the work, to the fullest extent permitted by applicable law.
12 |
13 | When using or citing the work, you should not imply endorsement by the author or the affirmer.
14 |
15 | This is a [human-readable summary of the Legal Code](//creativecommons.org/publicdomain/zero/1.0/) ([read the full text](//creativecommons.org/publicdomain/zero/1.0/)).
16 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Element QSA Scope [][Element QSA Scope]
2 |
3 | [![NPM Version][npm-img]][npm-url]
4 | [![Build Status][cli-img]][cli-url]
5 | [![Licensing][lic-img]][lic-url]
6 | [![Changelog][log-img]][log-url]
7 | [![Gitter Chat][git-img]][git-url]
8 |
9 | [Element QSA Scope] lets you select elements relative to the current node. It
10 | is a polyfill for `:scope` support within the selector methods
11 | [`Element#querySelector`], [`Element#querySelectorAll`], [`Element#matches`],
12 | and [`Element#closest`].
13 |
14 | ```bash
15 | npm install element-qsa-scope
16 | ```
17 |
18 | The entire script is 341 bytes when minified and gzipped.
19 |
20 | ### How it works
21 |
22 | By default, selector methods return elements matching CSS selectors absolutely
23 | from the document, similar to an element being matched with [`Element#matches`].
24 | Imagine the following document:
25 |
26 | ```html
27 |