Skip to content

Commit d049ce9

Browse files
committed
fix backslash hack parse error
1 parent aa7e232 commit d049ce9

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ module.exports = function(css, options){
202202
var pos = position();
203203

204204
// prop
205-
var prop = match(/^(\*?[-#\/\*\w]+(\[[0-9a-z_-]+\])?)\s*/);
205+
var prop = match(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);
206206
if (!prop) return;
207207
prop = trim(prop[0]);
208208

test/cases/comment.in.css

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
a {
22
color/**/: 12px;
33
padding/*4815162342*/: 1px /**/ 2px /*13*/ 3px;
4-
}
4+
border/*\**/: solid; border-top/*\**/: none\9;
5+
}

test/cases/comment.in.json

+33-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,38 @@
3939
},
4040
"source": "comment.in.css"
4141
}
42+
},
43+
{
44+
"type": "declaration",
45+
"property": "border",
46+
"value": "solid",
47+
"position": {
48+
"start": {
49+
"line": 4,
50+
"column": 5
51+
},
52+
"end": {
53+
"line": 4,
54+
"column": 24
55+
},
56+
"source": "comment.in.css"
57+
}
58+
},
59+
{
60+
"type": "declaration",
61+
"property": "border-top",
62+
"value": "none\\9",
63+
"position": {
64+
"start": {
65+
"line": 4,
66+
"column": 26
67+
},
68+
"end": {
69+
"line": 4,
70+
"column": 50
71+
},
72+
"source": "comment.in.css"
73+
}
4274
}
4375
],
4476
"position": {
@@ -47,7 +79,7 @@
4779
"column": 1
4880
},
4981
"end": {
50-
"line": 4,
82+
"line": 5,
5183
"column": 2
5284
},
5385
"source": "comment.in.css"

0 commit comments

Comments
 (0)