4 https://bugzilla.mozilla.org/show_bug.cgi?id=543428
7 <title>Test for Bug
543428</title>
8 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
9 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
11 <style type=
"text/css" id=
"sheet">p { color: blue; }
</style>
14 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=543428">Mozilla Bug
543428</a>
16 <div id=
"content" style=
"display: none">
20 <script type=
"application/javascript">
22 /** Test for Bug
543428 **/
24 var sheet = document.getElementById(
"sheet").sheet;
25 var rule = sheet.cssRules[
0];
27 function set_selector_text(selector)
28 // no cssText or selectorText setter implemented yet
31 // insertRule might throw on syntax error
32 sheet.insertRule(selector +
" { color : green }",
0);
35 rule = sheet.cssRules[
0];
38 is(rule.selectorText,
"p",
"simple identifier not escaped");
39 set_selector_text('\\P');
40 is(rule.selectorText,
"P",
"simple identifier not escaped");
41 set_selector_text('\\
70');
42 is(rule.selectorText,
"p",
"simple identifier not escaped");
43 set_selector_text('font-family_72756');
44 is(rule.selectorText,
"font-family_72756",
"simple identifier not escaped");
45 set_selector_text('-font-family_72756');
46 is(rule.selectorText,
"-font-family_72756",
"simple identifier not escaped");
47 set_selector_text('-
0invalid');
48 set_selector_text('
0invalid');
49 is(rule.selectorText,
"-font-family_72756",
"setting invalid value ignored");
50 set_selector_text('Håkon\\ Lie');
51 is(rule.selectorText,
"Håkon\\ Lie",
"escaping done only where needed");