Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: LayoutTests/fast/dom/MutationObserver/document-fragment-insertion.html

Issue 12317072: Merge 143386 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1410/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../js/resources/js-test-pre.js"></script> 2 <script src="../../js/resources/js-test-pre.js"></script>
3 <script> 3 <script>
4 description('Inserting DocumentFragments should remove all children of the fragm ent before inserting the children.'); 4 description('Inserting DocumentFragments should remove all children of the fragm ent before inserting the children.');
5 5
6 window.jsTestIsAsync = true; 6 window.jsTestIsAsync = true;
7 7
8 function createObservedFragment() { 8 function createObservedFragment() {
9 var fragment = document.createDocumentFragment(); 9 var fragment = document.createDocumentFragment();
10 fragment.appendChild(document.createElement('b')); 10 fragment.appendChild(document.createElement('b'));
11 fragment.appendChild(document.createElement('i')); 11 fragment.appendChild(document.createElement('i'));
12 observer.observe(fragment, {childList: true}); 12 observer.observe(fragment, {childList: true});
13 return fragment; 13 return fragment;
14 } 14 }
15 15
16 function createObservedDiv() { 16 function createObservedDiv() {
17 return div; 17 return div;
18 } 18 }
19 19
20 function callback(mutations) { 20 function callback(mutations) {
21 window.mutations = mutations; 21 window.mutations = mutations;
22 } 22 }
23 var observer = new WebKitMutationObserver(callback); 23 var observer = new MutationObserver(callback);
24 24
25 function testAppendChild() { 25 function testAppendChild() {
26 debug('Testing appendChild'); 26 debug('Testing appendChild');
27 var div = document.createElement('div'); 27 var div = document.createElement('div');
28 observer.observe(div, {childList: true}); 28 observer.observe(div, {childList: true});
29 div.appendChild(createObservedFragment()); 29 div.appendChild(createObservedFragment());
30 setTimeout(function() { 30 setTimeout(function() {
31 shouldBe('mutations.length', '2'); 31 shouldBe('mutations.length', '2');
32 shouldBe('mutations[0].addedNodes.length', '0'); 32 shouldBe('mutations[0].addedNodes.length', '0');
33 shouldBe('mutations[0].removedNodes.length', '2'); 33 shouldBe('mutations[0].removedNodes.length', '2');
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 shouldBe('mutations[1].addedNodes.length', '2'); 68 shouldBe('mutations[1].addedNodes.length', '2');
69 shouldBe('mutations[1].removedNodes.length', '1'); 69 shouldBe('mutations[1].removedNodes.length', '1');
70 debug(''); 70 debug('');
71 finishJSTest(); 71 finishJSTest();
72 }, 0); 72 }, 0);
73 } 73 }
74 74
75 testAppendChild(); 75 testAppendChild();
76 </script> 76 </script>
77 <script src="../../js/resources/js-test-post.js"></script> 77 <script src="../../js/resources/js-test-post.js"></script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698