Skip to content

Commit af82ba7

Browse files
author
Andy Shea
committed
Improved class and ID regex selector match.
1 parent 7f86706 commit af82ba7

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-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/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)