blob: d773d248c12c35eaa5609d473cbc2fc010c6a033 (
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
|
<!DOCTYPE html>
<html>
<head>
<title>Shadow DOM Test: A_06_00_01</title>
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
<link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#styles">
<meta name="assert" content="Styles: CSS rules declared in an enclosing tree must not apply in a shadow tree if apply-author-styles flag is set to false for this tree">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../../html/resources/common.js"></script>
<script src="../../resources/shadow-dom-utils.js"></script>
</head>
<body>
<div id="log"></div>
<script>
//test apply-author-styles flag of ShadowRoot object (default value)
test(unit(function (ctx) {
var d = newRenderedHTMLDocument(ctx);
d.head.innerHTML = '<style>' +
'.invis {' +
'display:none;' +
'}' +
'</style>';
var host = d.createElement('div');
d.body.appendChild(host);
//Shadow root to play with
var s = host.attachShadow({mode: 'open'});
var div1 = d.createElement('div');
div1.innerHTML ='<span id="shd" class="invis">This is the shadow tree</span>';
s.appendChild(div1);
//apply-author-styles flag is false by default. Invisible style shouldn't be applied
assert_true(s.querySelector('#shd').offsetTop > 0,
'CSS styles declared in enclosing tree must not be applied in a shadow tree ' +
'if the apply-author-styles flag is set to false');
}), 'A_06_00_01_T01');
//test apply-author-styles flag of ShadowRoot object (set it)
test(unit(function (ctx) {
var d = newRenderedHTMLDocument(ctx);
d.head.innerHTML = '<style>' +
'.invis {' +
'display:none;' +
'}' +
'</style>';
var host = d.createElement('div');
d.body.appendChild(host);
//Shadow root to play with
var s = host.attachShadow({mode: 'open'});
var div1 = d.createElement('div');
div1.innerHTML ='<span id="shd" class="invis">This is the shadow tree</span>';
s.appendChild(div1);
//apply-author-styles flag is set to false. Invisible style shouldn't be applied
assert_true(s.querySelector('#shd').offsetTop > 0,
'CSS styles declared in enclosing tree must not be applied in a shadow tree ' +
'if the apply-author-styles flag is set to false');
}), 'A_06_00_01_T02');
</script>
</body>
</html>
|