summaryrefslogtreecommitdiffstats
path: root/layout/reftests/forms/legend/shadow-dom.html
blob: ad7babcf7c80c714470249c8c613e4f5a39a0dd4 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!DOCTYPE html>
<!--
     Any copyright is dedicated to the Public Domain.
     http://creativecommons.org/publicdomain/zero/1.0/
-->
<html class="reftest-wait" lang="en-US">
  <head>
  <title>Test LEGEND placed into FIELDSET shadow DOM</title>
  <link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1140579">
  <link rel="match" href="shadow-dom-ref.html">
<style>
html,body {
    color:black; background-color:white; font-size:16px; padding:0; margin:0;
}
.before::before {content: "a ";}
.after::after {content: " c";}
div.before::before {content: "X ";}
div.after::after {content: " Y";}
.b,.c { display:contents; }
</style>
  </head>
  <body>
    <fieldset id="host1" class="before"></fieldset>
    <fieldset id="host2"></fieldset>
    <fieldset id="host3" class="after"></fieldset>
    <fieldset id="host4" class="before after"></fieldset>
    <fieldset id="host5" class="after"></fieldset>
    <fieldset id="host6" class="before"></fieldset>
    <fieldset id="host7"></fieldset>
    <fieldset id="host8"></fieldset>
    <fieldset id="host9"></fieldset>

   <script>
      function shadow(id) {
        return document.getElementById(id).createShadowRoot();
      }
      function legend(s) {
        var e = document.createElement("legend");
        var t = document.createTextNode(s);
        e.appendChild(t);
        return e;
      }
      function contents(n) {
        var e = document.createElement("z");
        e.style.display = "contents";
        e.style.color = "blue"; 
        if (n) e.appendChild(n);
        return e;
      }

      document.body.offsetHeight;

      shadow("host1").innerHTML = '<content></content> c';
      shadow("host2").innerHTML = 'a <content></content> c';
      shadow("host3").innerHTML = 'a <content></content>';
      shadow("host4").innerHTML = '<content></content>';
      shadow("host5").innerHTML = 'a <content></content>';
      shadow("host6").innerHTML = '<z style="color:blue; display:contents"><content></content></z> c';
      shadow("host7").innerHTML = 'a <content select=".c"></content> <content select=".b"></content> B';
      shadow("host8").innerHTML = 'A <content select=".c"></content> <content select=".b"></content> B';
      shadow("host9").innerHTML = 'A <content select=".c"></content> <content select=".b"></content> B <content select=".b"></content>';

      function tweak() {
        document.body.offsetHeight;

        host1.appendChild(legend("1"));
        host2.appendChild(legend("2"));
        host3.appendChild(legend("3"));
        host4.appendChild(legend("4"));

        var e = legend("5");
        e.style.display = "contents";
        host5.appendChild(e);

        host6.appendChild(legend("6"));

        var e = legend("L");
        e.className = "b";
        host7.appendChild(e);
        var e = legend("7");
        e.className = "c";
        host7.appendChild(e);

        var e = legend("L");
        e.className = "b after";
        host8.appendChild(e);
        var e = legend("8");
        e.className = "c  before";
        host8.appendChild(e);

        var e = legend("L2");
        e.className = "b before after";
        host9.appendChild(e);
        var e = contents(legend(" L3"));
        e.className = "b before after";
        host9.appendChild(e);
        var e = legend("9");
        e.className = "c  before";
        host9.appendChild(e);

        document.body.offsetHeight;
        setTimeout(function() {
            document.body.offsetHeight;
            document.documentElement.removeAttribute("class");
          },0);
      }

      window.addEventListener("MozReftestInvalidate", tweak, false);
    </script>
  </body>
</html>