summaryrefslogtreecommitdiffstats
path: root/layout/reftests/css-display/display-contents-style-inheritance-1-dom-mutations.html
blob: c46bef29551c916a22a62e619c3c9e61c44f41bf (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
112
113
114
115
116
117
118
119
<!DOCTYPE html>
<!--
     Any copyright is dedicated to the Public Domain.
     http://creativecommons.org/publicdomain/zero/1.0/
-->
<html lang="en-US" class="reftest-wait">
<head>
  <meta charset="utf-8">
  <title>CSS Test: CSS display:contents; style inheritance, DOM mutations</title>
  <link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=907396">
  <link rel="help" href="http://dev.w3.org/csswg/css-display">
<style type="text/css">
body,span { color:black; background-color:white; }
.test { display:contents; }
.green { color:green; }
.border { border-left:1px solid green; }
b { border:inherit; font-weight:normal; }
</style>
<script>
function $(id) { return document.getElementById(id); }
function text(s) { return document.createTextNode(s); }
function b(s) { var e = document.createElement('b'); e.appendChild(document.createTextNode(s)); return e; }
function div(s) { var e = document.createElement('div'); e.setAttribute('class','test'); e.appendChild(document.createTextNode(s)); return e; }
function runTest() {
  document.body.offsetHeight;

  var e = $('t1');
  var c = e.firstChild;
  e.insertBefore(text('g'), c);
  e.insertBefore(text('r'), c);
  e.appendChild(text('n'));

  var e = $('t1b');
  var c = e.firstChild;
  e.insertBefore(text('g'), c);
  e.insertBefore(text('r'), c);
  e.appendChild(text('n'));

  var e = $('t2');
  var c = e.firstChild;
  e.insertBefore(text('gr'), c);
  e.appendChild(text('n'));

  var e = $('t2b');
  var c = e.firstChild;
  e.insertBefore(text('gr'), c);
  e.appendChild(text('n'));

  var e = $('t3');
  var c = e.firstChild;
  e.insertBefore(text('n'), c);
  e.insertBefore(text('o'), c);
  e.appendChild(text('er'));

  var e = $('t4');
  var c = e.firstChild;
  e.insertBefore(text('n'), c);
  e.insertBefore(text('o'), c);
  e.appendChild(text('er'));

  var e = $('t5');
  var c = e.firstChild;
  e.insertBefore(b('1px green left '), c);
  e.appendChild(text('er'));

  var e = $('t6');
  e.appendChild(b('2px green left border'));

  var e = $('t7');
  e.appendChild(div('green'));

  var e = $('t8');
  e.appendChild(div('green'));

  var e = $('t9');
  var c = b("1px green left border");
  var d = div('');
  d.appendChild(c);
  e.appendChild(d);

  var e = $('t10');
  var c = b("1px green left border");
  var d = div('');
  d.setAttribute('style','border:inherit');
  d.appendChild(c);
  e.appendChild(d);

  var e = $('t11');
  var c = b("2px green left border");
  var d = div('');
  d.setAttribute('style','border:inherit');
  d.appendChild(c);
  e.appendChild(d);

  document.documentElement.className = '';
}
</script>
</head>
<body onload="runTest()">

<span class="green"><div class="test" id="t1">ee</div></span>
<span class="green"><div class="test" id="t1b">ee</div>x</span>
<span><div class="test green" id="t2">ee</div></span>
<span><div class="test green" id="t2b">ee</div>x</span>
<br>
<span><div class="test border" id="t3"> bord</div></span>
<span><div class="test border" id="t4"><span> bord</span></div></span>
<span class="border"><div class="test" id="t5">bord</div></span>
<span class="border"><div class="test" style="border:inherit" id="t6"></div></span>
<br>

<span class="green"><div class="test" id="t7"></div></span>
<span><div class="test green" id="t8"></div></span>
<br>
<span class="border"><div class="test" id="t9"></div></span>
<span class="border"><div class="test" id="t10"></div></span>
<span class="border"><div class="test" style="border:inherit" id="t11"></div></span>
</body>
</html>