Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / imported / web-platform-tests / shadow-dom / events / test-001.html
1 <!DOCTYPE html>
2 <!-- 
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].
6
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
10  -->
11 <html>
12 <head>
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">
21 </head>
22 <body>
23 <div id="log"></div>
24 <script>
25 var A_05_00_01_T1 = async_test('A_05_00_01_T1');
26
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);
31
32     iframe.onload = A_05_00_01_T1.step_func(function () {
33
34     try {
35         var d = iframe.contentDocument;
36
37         var div = d.createElement('div');
38         d.body.appendChild(div);
39
40         var s = div.createShadowRoot();
41
42         var div2 = d.createElement('div');
43         s.appendChild(div2);
44
45         var inp = d.createElement('input');
46         inp.setAttribute('type', 'text');
47         inp.setAttribute('id', 'inpid');
48         div2.appendChild(inp);
49
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');
52         }), false);
53         /*
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);
58                 */
59         inp.value = 'new value';
60         inp.setAttribute ("newAttr" , "firstValue");
61         inp.setAttribute ("newAttr" , "secondValue");
62         inp.removeAttribute ("newAttr");
63     } finally {
64         iframe.parentNode.removeChild(iframe);
65     }
66     A_05_00_01_T1.done();
67     });
68 });
69 </script>
70 </body>
71 </html>