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

Side by Side Diff: LayoutTests/fast/dom/MutationObserver/delivery-order.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 window.jsTestIsAsync = true; 4 window.jsTestIsAsync = true;
5 5
6 description('Test that MutationObservers are delivered to in order of creation.' ); 6 description('Test that MutationObservers are delivered to in order of creation.' );
7 function finish() { 7 function finish() {
8 shouldBe('order.length', '10'); 8 shouldBe('order.length', '10');
9 shouldBe('order[0]', '0'); 9 shouldBe('order[0]', '0');
10 shouldBe('order[1]', '1'); 10 shouldBe('order[1]', '1');
11 shouldBe('order[2]', '2'); 11 shouldBe('order[2]', '2');
12 shouldBe('order[3]', '3'); 12 shouldBe('order[3]', '3');
13 shouldBe('order[4]', '4'); 13 shouldBe('order[4]', '4');
14 shouldBe('order[5]', '5'); 14 shouldBe('order[5]', '5');
15 shouldBe('order[6]', '6'); 15 shouldBe('order[6]', '6');
16 shouldBe('order[7]', '7'); 16 shouldBe('order[7]', '7');
17 shouldBe('order[8]', '8'); 17 shouldBe('order[8]', '8');
18 shouldBe('order[9]', '9'); 18 shouldBe('order[9]', '9');
19 finishJSTest(); 19 finishJSTest();
20 } 20 }
21 21
22 var order = []; 22 var order = [];
23 var observers = []; 23 var observers = [];
24 24
25 function setUpOrdering(num) { 25 function setUpOrdering(num) {
26 observers.push(new WebKitMutationObserver(function(mutations) { 26 observers.push(new MutationObserver(function(mutations) {
27 order.push(num); 27 order.push(num);
28 })); 28 }));
29 } 29 }
30 30
31 for (var i = 0; i < 10; ++i) { 31 for (var i = 0; i < 10; ++i) {
32 setUpOrdering(i); 32 setUpOrdering(i);
33 } 33 }
34 34
35 var div = document.createElement('div'); 35 var div = document.createElement('div');
36 observers[3].observe(div, {attributes: true}); 36 observers[3].observe(div, {attributes: true});
37 observers[2].observe(div, {characterData: true, subtree: true}); 37 observers[2].observe(div, {characterData: true, subtree: true});
38 observers[1].observe(div, {attributes: true}); 38 observers[1].observe(div, {attributes: true});
39 observers[7].observe(div, {childList: true}); 39 observers[7].observe(div, {childList: true});
40 observers[4].observe(div, {attributes: true}); 40 observers[4].observe(div, {attributes: true});
41 observers[9].observe(div, {attributes: true}); 41 observers[9].observe(div, {attributes: true});
42 observers[0].observe(div, {childList: true}); 42 observers[0].observe(div, {childList: true});
43 observers[5].observe(div, {attributes: true}); 43 observers[5].observe(div, {attributes: true});
44 observers[6].observe(div, {characterData: true, subtree: true}); 44 observers[6].observe(div, {characterData: true, subtree: true});
45 observers[8].observe(div, {attributes: true}); 45 observers[8].observe(div, {attributes: true});
46 div.setAttribute('foo', 'bar'); 46 div.setAttribute('foo', 'bar');
47 div.appendChild(document.createTextNode('hello')); 47 div.appendChild(document.createTextNode('hello'));
48 div.firstChild.textContent = 'goodbye'; 48 div.firstChild.textContent = 'goodbye';
49 setTimeout(finish, 0); 49 setTimeout(finish, 0);
50 </script> 50 </script>
51 <script src="../../js/resources/js-test-post.js"></script> 51 <script src="../../js/resources/js-test-post.js"></script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698