Skip to content

Commit f5b90ae

Browse files
committed
Merge pull request reworkcss#77 from suisho/css-hack-fix
Fix backslash hack parse error
2 parents 251b596 + d049ce9 commit f5b90ae

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ module.exports = function(css, options){
210210
var pos = position();
211211

212212
// prop
213-
var prop = match(/^(\*?[-#\/\*\w]+(\[[0-9a-z_-]+\])?)\s*/);
213+
var prop = match(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);
214214
if (!prop) return;
215215
prop = trim(prop[0]);
216216

test/cases/comment.in.css

Lines changed: 2 additions & 1 deletion
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

Lines changed: 33 additions & 1 deletion
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)