Skip to content

Commit 2542ffb

Browse files
committed
Add CSS selector parser
1 parent 124cc37 commit 2542ffb

File tree

133 files changed

+2642
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+2642
-0
lines changed

lib/utils/selector.js

Lines changed: 664 additions & 0 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"dependencies": {
5757
"eslint-utils": "^3.0.0",
5858
"natural-compare": "^1.4.0",
59+
"nth-check": "^2.0.1",
5960
"postcss-selector-parser": "^6.0.9",
6061
"semver": "^7.3.5",
6162
"vue-eslint-parser": "^8.0.1"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[
2+
{
3+
"text": "<a href=\"http://example.com\">",
4+
"selector": "a[href*=\"example\"]",
5+
"elementText": null
6+
},
7+
{
8+
"text": "<a href=\"http://example.org\">",
9+
"selector": "a[href*=\"example\"]",
10+
"elementText": null
11+
},
12+
{
13+
"text": "<a href=\"https://example.org\">",
14+
"selector": "a[href*=\"example\"]",
15+
"elementText": null
16+
}
17+
]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!-- a[href*="example"] -->
2+
<template>
3+
<ul>
4+
<li><a href="#internal">Internal link</a></li>
5+
<li><a href="http://example.com">Example link</a></li>
6+
<li><a href="#InSensitive">Insensitive internal link</a></li>
7+
<li><a href="http://example.org">Example org link</a></li>
8+
<li><a href="https://example.org">Example https org link</a></li>
9+
</ul>
10+
</template>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[
2+
{
3+
"text": "<p foo>",
4+
"selector": "[foo=]",
5+
"elementText": "<* foo=\"\">"
6+
},
7+
{
8+
"text": "<div foo=\"\">",
9+
"selector": "[foo=]",
10+
"elementText": "<* foo=\"\">"
11+
}
12+
]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- [foo=] -->
2+
<template>
3+
<div foo="foo">
4+
<div foo=bar></div>
5+
<div foo="foo bar"></div>
6+
<p foo></p>
7+
<input bar="foo">
8+
<input foo="foo">
9+
<div foo=""></div>
10+
</div>
11+
</template>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[
2+
{
3+
"text": "<div foo=\"foo\">",
4+
"selector": "[foo=foo]",
5+
"elementText": "<* foo=\"foo\">"
6+
},
7+
{
8+
"text": "<input foo=\"foo\">",
9+
"selector": "[foo=foo]",
10+
"elementText": "<* foo=\"foo\">"
11+
}
12+
]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- [foo=foo] -->
2+
<template>
3+
<div foo="foo">
4+
<div foo=bar></div>
5+
<div foo="foo bar"></div>
6+
<p foo></p>
7+
<input bar="foo">
8+
<input foo="foo">
9+
<div foo=""></div>
10+
</div>
11+
</template>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[
2+
{
3+
"text": "<div foo=\"foo\">",
4+
"selector": "[foo]",
5+
"elementText": "<* foo>"
6+
},
7+
{
8+
"text": "<p foo>",
9+
"selector": "[foo]",
10+
"elementText": "<* foo>"
11+
}
12+
]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<!-- [foo] -->
2+
<template>
3+
<div foo="foo">
4+
<div bar></div>
5+
<p foo></p>
6+
<input bar="foo">
7+
</div>
8+
</template>

0 commit comments

Comments
 (0)