summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/shadow-dom/untriaged/shadow-trees/upper-boundary-encapsulation/test-005.html
blob: 0cf978a2699f8d9460c84851129cdb68415a4cb7 (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
<!DOCTYPE html>
<!--
Distributed under both the W3C Test Suite License [1] and the W3C
3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
policies and contribution forms [3].

[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
[3] http://www.w3.org/2004/10/27-testcases
-->
<html>
<head>
<title>Shadow DOM Test: A_04_01_05</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/#upper-boundary-encapsulation">
<meta name="assert" content="Upper-boundary encapsulation:The nodes with a unique id and named elements are not addressable from any attributes of elements in shadow host's document">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../../../html/resources/common.js"></script>
</head>
<body>
<div id="log"></div>
<script>
// check label.for attribute
test(function () {
    var d = newHTMLDocument();
    var div = d.createElement('div');
    d.body.appendChild(div);
    var s = div.attachShadow({mode: 'open'});

    // node in shadow with id
    var input = d.createElement('input');
    input.setAttribute('type', 'text');
    input.setAttribute('id', 'input_id');
    d.body.appendChild(input);
    s.appendChild(input);

    // node in host with a reference to host element with id
    var label = d.createElement('label');
    label.setAttribute('for', 'input_id');
    d.body.appendChild(label);

    assert_equals(label.control, null, 'Elements in shadow DOM must not be accessible from ' +
        'owner\'s document label.for attribute');

}, 'A_04_01_05_T01');

// check form associated elements
test(function () {

    HTML5_FORM_ASSOCIATED_ELEMENTS.forEach(function (tagName) {
        var d = newHTMLDocument();
        var div = d.createElement('div');
        d.body.appendChild(div);
        var s = div.attachShadow({mode: 'open'});

        var form = d.createElement('form');
        form.setAttribute('id', 'form_id');
        d.body.appendChild(form);

        var el = d.createElement(tagName);
        el.setAttribute('form', 'form_id');
        d.body.appendChild(el);

        s.appendChild(form);

        assert_equals(el.form, null, 'Elements in shadow DOM must not be accessible from ' +
            'owner\'s document ' + tagName + '.form attribute');
    });
}, 'A_04_01_05_T02');
</script>
</body>
</html>