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

Side by Side Diff: LayoutTests/fast/dom/MutationObserver/observe-subtree.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 <html> 2 <html>
3 <head> 3 <head>
4 <meta charset="utf-8"> 4 <meta charset="utf-8">
5 <script src="../../js/resources/js-test-pre.js"></script> 5 <script src="../../js/resources/js-test-pre.js"></script>
6 <title></title> 6 <title></title>
7 </head> 7 </head>
8 <body> 8 <body>
9 <p id=description></p> 9 <p id=description></p>
10 <div id="console"></div> 10 <div id="console"></div>
11 <script> 11 <script>
12 12
13 window.jsTestIsAsync = true; 13 window.jsTestIsAsync = true;
14 var mutations; 14 var mutations;
15 var mutations2; 15 var mutations2;
16 var div; 16 var div;
17 var subDiv, subDiv2, subDiv3, text; 17 var subDiv, subDiv2, subDiv3, text;
18 var calls; 18 var calls;
19 19
20 function testBasic() { 20 function testBasic() {
21 var observer; 21 var observer;
22 22
23 function start() { 23 function start() {
24 debug('Testing basic aspects of subtree observation.'); 24 debug('Testing basic aspects of subtree observation.');
25 25
26 mutations = null; 26 mutations = null;
27 div = document.createElement('div'); 27 div = document.createElement('div');
28 subDiv = div.appendChild(document.createElement('div')); 28 subDiv = div.appendChild(document.createElement('div'));
29 subDiv.innerHTML = 'hello, world'; 29 subDiv.innerHTML = 'hello, world';
30 observer = new WebKitMutationObserver(function(mutations) { 30 observer = new MutationObserver(function(mutations) {
31 window.mutations = mutations; 31 window.mutations = mutations;
32 }); 32 });
33 33
34 observer.observe(div, {attributes: true, characterData: true, subtree: t rue}); 34 observer.observe(div, {attributes: true, characterData: true, subtree: t rue});
35 subDiv.setAttribute('foo', 'bar'); 35 subDiv.setAttribute('foo', 'bar');
36 subDiv.firstChild.textContent = 'goodbye!'; 36 subDiv.firstChild.textContent = 'goodbye!';
37 setTimeout(finish, 0); 37 setTimeout(finish, 0);
38 } 38 }
39 39
40 function finish() { 40 function finish() {
(...skipping 18 matching lines...) Expand all
59 var observer; 59 var observer;
60 var observer2; 60 var observer2;
61 61
62 function start() { 62 function start() {
63 debug('Testing two observers at different depths.'); 63 debug('Testing two observers at different depths.');
64 64
65 mutations = null; 65 mutations = null;
66 mutations2 = null; 66 mutations2 = null;
67 div = document.createElement('div'); 67 div = document.createElement('div');
68 subDiv = div.appendChild(document.createElement('div')); 68 subDiv = div.appendChild(document.createElement('div'));
69 observer = new WebKitMutationObserver(function(mutations) { 69 observer = new MutationObserver(function(mutations) {
70 window.mutations = mutations; 70 window.mutations = mutations;
71 }); 71 });
72 observer2 = new WebKitMutationObserver(function(mutations) { 72 observer2 = new MutationObserver(function(mutations) {
73 window.mutations2 = mutations; 73 window.mutations2 = mutations;
74 }); 74 });
75 75
76 observer.observe(div, {attributes: true, subtree: true}); 76 observer.observe(div, {attributes: true, subtree: true});
77 observer2.observe(subDiv, {attributes: true}); 77 observer2.observe(subDiv, {attributes: true});
78 subDiv.setAttribute('foo', 'bar'); 78 subDiv.setAttribute('foo', 'bar');
79 setTimeout(finish, 0); 79 setTimeout(finish, 0);
80 } 80 }
81 81
82 function finish() { 82 function finish() {
(...skipping 19 matching lines...) Expand all
102 function testMultipleObservations() { 102 function testMultipleObservations() {
103 var observer; 103 var observer;
104 104
105 function start() { 105 function start() {
106 debug('Testing one observer at two different depths.'); 106 debug('Testing one observer at two different depths.');
107 107
108 mutations = null; 108 mutations = null;
109 calls = 0; 109 calls = 0;
110 div = document.createElement('div'); 110 div = document.createElement('div');
111 subDiv = div.appendChild(document.createElement('div')); 111 subDiv = div.appendChild(document.createElement('div'));
112 observer = new WebKitMutationObserver(function(mutations) { 112 observer = new MutationObserver(function(mutations) {
113 window.mutations = mutations; 113 window.mutations = mutations;
114 ++calls; 114 ++calls;
115 }); 115 });
116 116
117 observer.observe(div, {attributes: true, subtree: true}); 117 observer.observe(div, {attributes: true, subtree: true});
118 observer.observe(subDiv, {attributes: true, subtree: true}); 118 observer.observe(subDiv, {attributes: true, subtree: true});
119 subDiv.setAttribute('foo', 'bar'); 119 subDiv.setAttribute('foo', 'bar');
120 setTimeout(finish, 0); 120 setTimeout(finish, 0);
121 } 121 }
122 122
(...skipping 15 matching lines...) Expand all
138 function testTransientDetachedBasic() { 138 function testTransientDetachedBasic() {
139 var observer; 139 var observer;
140 140
141 function start() { 141 function start() {
142 debug('Testing that transiently detached nodes are still observed via su btree.'); 142 debug('Testing that transiently detached nodes are still observed via su btree.');
143 143
144 mutations = null; 144 mutations = null;
145 div = document.createElement('div'); 145 div = document.createElement('div');
146 subDiv = div.appendChild(document.createElement('div')); 146 subDiv = div.appendChild(document.createElement('div'));
147 subDiv.innerHTML = 'hello, world'; 147 subDiv.innerHTML = 'hello, world';
148 observer = new WebKitMutationObserver(function(mutations) { 148 observer = new MutationObserver(function(mutations) {
149 window.mutations = mutations; 149 window.mutations = mutations;
150 }); 150 });
151 151
152 observer.observe(div, {attributes: true, characterData: true, subtree: t rue}); 152 observer.observe(div, {attributes: true, characterData: true, subtree: t rue});
153 subDiv.setAttribute('foo', 'bar'); 153 subDiv.setAttribute('foo', 'bar');
154 div.removeChild(subDiv); 154 div.removeChild(subDiv);
155 subDiv.setAttribute('test', 'test'); 155 subDiv.setAttribute('test', 'test');
156 setTimeout(checkDeliveredAndChangeAgain, 0); 156 setTimeout(checkDeliveredAndChangeAgain, 0);
157 } 157 }
158 158
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 function start() { 223 function start() {
224 debug('Testing correct behavior of transient observation with complex mo vement .'); 224 debug('Testing correct behavior of transient observation with complex mo vement .');
225 225
226 mutations = null; 226 mutations = null;
227 div = document.createElement('div'); 227 div = document.createElement('div');
228 subDiv = div.appendChild(document.createElement('div')); 228 subDiv = div.appendChild(document.createElement('div'));
229 subDiv2 = subDiv.appendChild(document.createElement('div')); 229 subDiv2 = subDiv.appendChild(document.createElement('div'));
230 subDiv2.innerHTML = 'hello, world'; 230 subDiv2.innerHTML = 'hello, world';
231 subDiv3 = document.createElement('div'); 231 subDiv3 = document.createElement('div');
232 232
233 observer = new WebKitMutationObserver(function(mutations) { 233 observer = new MutationObserver(function(mutations) {
234 window.mutations = mutations; 234 window.mutations = mutations;
235 }); 235 });
236 236
237 observer.observe(div, {attributes: true, characterData: true, subtree: t rue}); 237 observer.observe(div, {attributes: true, characterData: true, subtree: t rue});
238 div.removeChild(subDiv); 238 div.removeChild(subDiv);
239 subDiv.removeChild(subDiv2); 239 subDiv.removeChild(subDiv2);
240 text = subDiv2.removeChild(subDiv2.firstChild); 240 text = subDiv2.removeChild(subDiv2.firstChild);
241 241
242 subDiv.setAttribute('a', 'a'); 242 subDiv.setAttribute('a', 'a');
243 subDiv2.setAttribute('b', 'b'); 243 subDiv2.setAttribute('b', 'b');
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 finishJSTest(); 296 finishJSTest();
297 } 297 }
298 298
299 description('Test WebKitMutationObserver.observe on a subtree'); 299 description('Test WebKitMutationObserver.observe on a subtree');
300 300
301 runNextTest(); 301 runNextTest();
302 </script> 302 </script>
303 <script src="../../js/resources/js-test-post.js"></script> 303 <script src="../../js/resources/js-test-post.js"></script>
304 </body> 304 </body>
305 </html> 305 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698