Skip to content

Commit 3a5e02d

Browse files
committed
add two specs for testing -moz-document
1 parent d943119 commit 3a5e02d

File tree

2 files changed

+94
-1
lines changed

2 files changed

+94
-1
lines changed

spec/parse.spec.js

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,98 @@ var TESTS = [
934934
result.cssRules[0].cssRules[0].style.parentRule = result.cssRules[0].cssRules[0];
935935
result.cssRules[0].cssRules[1].style.parentRule = result.cssRules[0].cssRules[1];
936936
result.cssRules[0].cssRules[2].style.parentRule = result.cssRules[0].cssRules[2];
937+
return result;
938+
})()
939+
},
940+
{
941+
input: "@-moz-document url(http://www.w3.org/), url-prefix(http://www.w3.org/Style/), domain(mozilla.org), regexp(\"https:.*\")\n{\n/*comments*/\nbody { color: purple; background: yellow; }\n}",
942+
result: (function() {
943+
var result = {
944+
cssRules: [
945+
{
946+
matcher: {
947+
0: "url(http://www.w3.org/)",
948+
1: "url-prefix(http://www.w3.org/Style/)",
949+
2: "domain(mozilla.org)",
950+
3: "regexp(\"https:.*\")",
951+
length: 4
952+
},
953+
cssRules: [
954+
{
955+
selectorText: "body",
956+
style: {
957+
0: "color",
958+
1: "background",
959+
length: 2,
960+
__starts: 138,
961+
color: "purple",
962+
background: "yellow"
963+
},
964+
__starts: 133,
965+
__ends: 176
966+
}
967+
],
968+
parentRule: null,
969+
__starts: 0,
970+
__ends: 178
971+
}
972+
],
973+
parentStyleSheet: null
974+
};
975+
result.cssRules[0].parentStyleSheet = result.cssRules[0].cssRules[0].parentStyleSheet = result;
976+
result.cssRules[0].cssRules[0].parentRule = result.cssRules[0];
977+
result.cssRules[0].cssRules[0].style.parentRule = result.cssRules[0].cssRules[0];
978+
979+
return result;
980+
})()
981+
},
982+
{
983+
input: "a{}@-moz-document/**/url-prefix(http://www.w3.org/Style/){body { color: purple; background: yellow; }}",
984+
result: (function(){
985+
var result = {
986+
cssRules: [
987+
{
988+
selectorText: 'a',
989+
style: {
990+
length: 0,
991+
__starts: 1
992+
},
993+
parentRule: null,
994+
__starts: 0,
995+
__ends: 3
996+
},
997+
{
998+
matcher: {
999+
0: "url-prefix(http://www.w3.org/Style/)",
1000+
length: 1
1001+
},
1002+
cssRules: [
1003+
{
1004+
selectorText: "body",
1005+
style: {
1006+
0: "color",
1007+
1: "background",
1008+
length: 2,
1009+
__starts: 64,
1010+
color: "purple",
1011+
background: "yellow"
1012+
},
1013+
__starts: 59,
1014+
__ends: 102
1015+
}
1016+
],
1017+
parentRule: null,
1018+
__starts: 3,
1019+
__ends: 103
1020+
}
1021+
],
1022+
parentStyleSheet: null
1023+
};
1024+
result.cssRules[0].parentStyleSheet = result.cssRules[1].parentStyleSheet = result.cssRules[1].cssRules[0].parentStyleSheet = result;
1025+
result.cssRules[1].cssRules[0].parentRule = result.cssRules[1];
1026+
result.cssRules[1].cssRules[0].style.parentRule = result.cssRules[1].cssRules[0];
1027+
result.cssRules[0].style.parentRule = result.cssRules[0];
1028+
9371029
return result;
9381030
})()
9391031
}

src/files.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ exports.files = [
1010
"CSSStyleSheet",
1111
"CSSKeyframesRule",
1212
"CSSKeyframeRule",
13-
"CSSDocumentRule",
13+
"MatcherList",
14+
"CSSDocumentRule",
1415
"CSSValue",
1516
"CSSValueExpression",
1617
"parse",

0 commit comments

Comments
 (0)