3 Distributed under both the W3C Test Suite License [1] and the W3C
4 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
5 policies and contribution forms [3].
7 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
8 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
9 [3] http://www.w3.org/2004/10/27-testcases
13 <title>Shadow DOM Test: A_05_00_01</title>
14 <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
15 <link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#events">
16 <meta name="assert" content="Events:The mutation event types must never be dispatched in a shadow DOM subtree.">
17 <script src="../../../../resources/testharness.js"></script>
18 <script src="../../../../resources/testharnessreport.js"></script>
19 <script src="../testcommon.js"></script>
20 <link rel="stylesheet" href="../../../../resources/testharness.css">
25 var A_05_00_01_T1 = async_test('A_05_00_01_T1');
27 A_05_00_01_T1.step(function () {
28 var iframe = document.createElement('iframe');
29 iframe.src = '../resources/blank.html';
30 document.body.appendChild(iframe);
32 iframe.onload = A_05_00_01_T1.step_func(function () {
35 var d = iframe.contentDocument;
37 var div = d.createElement('div');
38 d.body.appendChild(div);
40 var s = div.createShadowRoot();
42 var div2 = d.createElement('div');
45 var inp = d.createElement('input');
46 inp.setAttribute('type', 'text');
47 inp.setAttribute('id', 'inpid');
48 div2.appendChild(inp);
50 div2.addEventListener('DOMAttrModified', A_05_00_01_T1.step_func(function (event) {
51 assert_true(false, 'The mutation event types must never be dispatched in a shadow DOM subtree');
54 var attr = inp.getAttributeNode ("value");
55 var event = d.createEvent('MutationEvent');
56 event.initMutationEvent ("DOMAttrModified", true, true, attr, null, 'new value', "value", MutationEvent.MODIFICATION);
57 inp.dispatchEvent(event);
59 inp.value = 'new value';
60 inp.setAttribute ("newAttr" , "firstValue");
61 inp.setAttribute ("newAttr" , "secondValue");
62 inp.removeAttribute ("newAttr");
64 iframe.parentNode.removeChild(iframe);