tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

serialize-escape-identifiers.html (981B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <title>Properly escape CSS identifiers</title>
      5    <script src="/resources/testharness.js"></script>
      6    <script src="/resources/testharnessreport.js"></script>
      7    <link rel="help" href="https://crbug.com/343000522">
      8    <style id="sheet">
      9      @import 'abc' layer(\{\});
     10      @counter-style abc\{\}oops {}
     11      @font-feature-values abc\{\}oops {}
     12      @font-palette-values --abc\{\}oops {}
     13      @keyframes abc\{\}oops {}
     14      @layer abc\;oops\!;
     15    </style>
     16  </head>
     17  <body>
     18  <script>
     19    test(()=>{
     20      const rules = Array.from(document.styleSheets[0].cssRules);
     21      const text = rules.map(r => r.cssText).join('\n');
     22      sheet.innerText = text;
     23 
     24      const new_rules = Array.from(document.styleSheets[0].cssRules);
     25      const new_text = new_rules.map(r => r.cssText).join('\n');
     26      assert_equals(new_text, text);
     27    }, 'Rules must be the same after serialization round-trip, even with escaped characters');
     28  </script>