Skip to content

Commit 73569cb

Browse files
committed
added local and global as nested pseudo classes
1 parent edf0b50 commit 73569cb

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

lib/parse.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ var parser = new Parser({
157157
"/\\*([\\s\\S]*?)\\*/": commentMatch,
158158
"\\.([A-Za-z_\\-0-9]+)": typeMatch("class"),
159159
"#([A-Za-z_\\-0-9]+)": typeMatch("id"),
160-
":(not|has)\\((\\s*)": nestedPseudoClassStartMatch,
160+
":(not|has|local|global)\\((\\s*)": nestedPseudoClassStartMatch,
161161
":([A-Za-z_\\-0-9]+)\\(": pseudoClassStartMatch,
162162
":([A-Za-z_\\-0-9]+)": typeMatch("pseudo-class"),
163163
"::([A-Za-z_\\-0-9]+)": typeMatch("pseudo-element"),

test/test-cases.js

+33
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,39 @@ module.exports = {
215215
])
216216
],
217217

218+
"export": [
219+
":export",
220+
singleSelector([
221+
{ type: "pseudo-class", name: "export" }
222+
])
223+
],
224+
225+
"local and global": [
226+
":global :local :global(.className a[href]):local( #idName )",
227+
singleSelector([
228+
{ type: "pseudo-class", name: "global" },
229+
{ type: "spacing", value: " " },
230+
{ type: "pseudo-class", name: "local" },
231+
{ type: "spacing", value: " " },
232+
{ type: "nested-pseudo-class", name: "global", nodes: [
233+
{ type: "selector", nodes: [
234+
{ type: "class", name: "className" },
235+
{ type: "spacing", value: " " },
236+
{ type: "element", name: "a" },
237+
{ type: "attribute", content: "href" }
238+
] }
239+
] },
240+
{ type: "nested-pseudo-class", name: "local", nodes: [
241+
{
242+
type: "selector", nodes: [
243+
{ type: "id", name: "idName" }
244+
],
245+
before: " ", after: " "
246+
}
247+
] }
248+
])
249+
],
250+
218251
"nested pseudo class with multiple selectors": [
219252
":has( h1, h2 )",
220253
singleSelector([

0 commit comments

Comments
 (0)