Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / MutationObserver / cross-document.html
blob3377ec054ee898336fa4ce06c7dfef1591a0d121
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <script>
9 window.jsTestIsAsync = true;
10 var mutations;
11 var div, subDiv;
13 function testBasic() {
14 var observer;
16 function start() {
17 debug('Testing basic aspects of cross-document observation.');
19 mutations = null;
20 div = document.createElement('div');
21 observer = new MutationObserver(function(mutations) {
22 window.mutations = mutations;
23 });
25 observer.observe(div, {attributes: true});
26 var newDoc = document.implementation.createDocument('', '', null);
27 newDoc.appendChild(div);
28 div.id = 'foo';
29 setTimeout(finish, 0);
32 function finish() {
33 shouldBe('mutations.length', '1');
34 shouldBe('mutations[0].type', '"attributes"');
35 shouldBe('mutations[0].target', 'div');
36 shouldBe('mutations[0].attributeName', '"id"');
37 shouldBe('mutations[0].attributeNamespace', 'null');
38 observer.disconnect();
39 debug('');
40 runNextTest();
43 start();
46 function testSubtree() {
47 var observer;
49 function start() {
50 debug('Testing that subtree observation works after node is moved.');
52 mutations = null;
53 div = document.createElement('div');
54 subDiv = div.appendChild(document.createElement('div'));
55 observer = new MutationObserver(function(mutations) {
56 window.mutations = mutations;
57 });
59 observer.observe(div, {attributes: true, subtree: true});
60 var newDoc = document.implementation.createDocument('', '', null);
61 newDoc.appendChild(div);
62 subDiv.id = 'foo';
63 setTimeout(finish, 0);
66 function finish() {
67 shouldBe('mutations.length', '1');
68 shouldBe('mutations[0].type', '"attributes"');
69 shouldBe('mutations[0].target', 'subDiv');
70 shouldBe('mutations[0].attributeName', '"id"');
71 shouldBe('mutations[0].attributeNamespace', 'null');
72 observer.disconnect();
73 debug('');
74 runNextTest();
77 start();
80 var tests = [testBasic, testSubtree];
81 var testIndex = 0;
83 function runNextTest() {
84 if (testIndex < tests.length)
85 tests[testIndex++]();
86 else
87 finishJSTest();
90 description('Test that MutationObservers move correctly across documents');
92 runNextTest();
94 </script>
95 </body>
96 </html>