Skip to content

Commit 435a391

Browse files
committed
Merge branch 'andy-shea-class_and_id_regex_fix'
2 parents 7f86706 + 14c5a27 commit 435a391

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

lib/parseSource.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,10 @@ var parser = new Parser({
236236
"(\\s+):global\\s+": enableGlobal,
237237

238238
// class
239-
"(\\.)([A-Za-z_\\-0-9]+)": selectorMatch,
239+
"(\\.)(-?[_a-zA-Z]+[_a-zA-Z0-9-]*)": selectorMatch,
240240

241241
// id
242-
"(#)([A-Za-z_\\-0-9]+)": selectorMatch,
242+
"(#)(-?[_a-zA-Z]+[_a-zA-Z0-9-]*)": selectorMatch,
243243

244244
// inside
245245
"\\{": rulesStartMatch,

test/localTest.js

+5
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,9 @@ describe("local", function() {
113113
someId: "_1j3LM6lKkKzRIt19ImYVnD",
114114
subClass: "_13LGdX8RMStbBE9w-t0gZ1"
115115
}, "?module");
116+
testLocal("class name parsing", ".-a0-34a___f { color: red; }", [
117+
[1, "._1YJOcrkc6cyZmBAAvyPFOn { color: red; }", ""]
118+
], {
119+
"-a0-34a___f": "_1YJOcrkc6cyZmBAAvyPFOn"
120+
}, "?module");
116121
});

test/moduleTestCases/simple/expected.css

+3
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ a[href="#b.c"]._x_._y_ {
66
color: green;
77
font-size: 1.5pt;
88
}
9+
@keyframes _z_ {
10+
2.5% {color: green;}
11+
}

test/moduleTestCases/simple/source.css

+3
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ a[href="#b.c"].x.y {
66
color: green;
77
font-size: 1.5pt;
88
}
9+
@keyframes z {
10+
2.5% {color: green;}
11+
}

0 commit comments

Comments
 (0)