summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-shadow-parts/serialization.html
blob: 50ad3df53a33a3c3ae24d4130356619c8d02d182 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!DOCTYPE html>
<html>
  <head>
    <title>CSS Shadow Parts - Serialization</title>
    <link href="https://drafts.csswg.org/css-shadow-parts/" rel="help">
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
  </head>
  <body>
    <style id="styleElement">
      ::part(\(foo) {}
      ::part(   bar\    ) {}
      ::part( -foo  bar    ) {}
    </style>
    <script>
      "use strict";
      const rules = styleElement.sheet.cssRules;
      test(function() {
        assert_equals(rules[0].selectorText, "::part(\\(foo)");
      }, "Escape start parenthesis in ::part name.");
      test(function() {
        assert_equals(rules[1].selectorText, "::part(bar\\ )");
      }, "Escape start space in ::part name.");
      test(function() {
        assert_equals(rules[2].selectorText, "::part(-foo bar)");
      }, "Collapse spaces in ::part names list.");
    </script>
  </body>
</html>