1 <!-- Valid src descriptor rules. -->
7 src: url(http://foo/bar/font.ttf);
10 src: url(font.svg#id);
13 src: url(font.ttf) format(
"truetype");
16 src: url(font.woff) format(
"woff"), local(font2);
19 src: url(font.ttf) format(
"truetype"), url(font2.ttf);
22 src: url(font.ttf), url(font2.ttf) format(
"truetype");
25 src: url(font.ttf), local(font2), url(font3.otf) format(
"opentype"), local(foo bar);
31 src: local(font), local(foo bar);
37 src: local(
"foo bar");
41 <!-- Invalid src descriptor rules. -->
44 src: url(font.ttf invalid);
50 src: url(font.ttf), local(font2),;
56 src: url(font.ttf), invalid();
59 src: url(foo.ttf) invalid;
63 src: url(foo.ttf), invalid;
66 src: url(foo.ttf)
"invalid";
69 src: url(foo.ttf) !important;
81 <p>Test parsing the src descriptor of @font-face.
</p>
83 <p>Valid rules form the stylesheet:
</p>
84 <div id=
"validResult"></div>
86 <p>Expected result for valid rules:
</p>
87 <pre id=
"validExpected">@font-face { src: url(font.ttf); }
88 @font-face { src: url(http://foo/bar/font.ttf); }
89 @font-face { src: url(font.svg#id); }
90 @font-face { src: url(font.ttf) format(truetype); }
91 @font-face { src: url(font.woff) format(woff), local(font2); }
92 @font-face { src: url(font2.ttf); }
93 @font-face { src: url(font2.ttf) format(truetype); }
94 @font-face { src: url(font3.otf) format(opentype), local(foo bar); }
95 @font-face { src: local(foo); }
96 @font-face { src: local(font), local(foo bar); }
97 @font-face { src: local(foo); }
98 @font-face { src: local(foo bar); }
101 <p>Invalid rules form the stylesheet:
</p>
102 <pre id=
"invalidResult"></pre>
104 <p>Expected result for invalid rules:
</p>
105 <pre id=
"invalidExpected">@font-face { }
117 if (window
.testRunner
)
118 testRunner
.dumpAsText();
120 var validRules
= document
.styleSheets
[0].cssRules
;
122 for (var i
= 0; i
< validRules
.length
; ++i
) {
123 var itemText
= validRules
.item(i
).cssText
.replace(/file:.*LayoutTests\/fast\/css\//, '');
124 result
+= itemText
+ '\n';
126 document
.getElementById('validResult').innerText
= result
;
128 var invalidRules
= document
.styleSheets
[1].cssRules
;
130 for (var i
= 0; i
< invalidRules
.length
; ++i
) {
131 var itemText
= invalidRules
.item(i
).cssText
.replace(/file:.*LayoutTests\/fast\/css\//, '');
132 result
+= itemText
+ '\n';
134 document
.getElementById('invalidResult').innerText
= result
;