layout/style/test/test_ident_escaping.html

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=543428
     5 -->
     6 <head>
     7   <title>Test for Bug 543428</title>
     8   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     9   <script type="application/javascript" 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>
    12 </head>
    13 <body>
    14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=543428">Mozilla Bug 543428</a>
    15 <p id="display"></p>
    16 <div id="content" style="display: none">
    18 </div>
    19 <pre id="test">
    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
    29 {
    30   try {
    31     // insertRule might throw on syntax error
    32     sheet.insertRule(selector + " { color : green }", 0);
    33     sheet.deleteRule(1);
    34   } catch(ex) {}
    35   rule = sheet.cssRules[0];
    36 }
    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");
    53 </script>
    54 </pre>
    55 </body>
    56 </html>

mercurial