OLD | NEW |
1 <html> | 1 <html> |
2 <link rel="import" href="../resources/chai.sky" /> | 2 <import src="../resources/chai.sky" /> |
3 <link rel="import" href="../resources/mocha.sky" /> | 3 <import src="../resources/mocha.sky" /> |
4 <script> | 4 <script> |
5 describe('MutationObserver', function() { | 5 describe('MutationObserver', function() { |
6 it('should not invoke callbacks when appending a script', function() { | 6 it('should not invoke callbacks when appending a script', function() { |
7 var mutationsDelivered = false; | 7 var mutationsDelivered = false; |
8 function callback(mutations) { | 8 function callback(mutations) { |
9 mutationsDelivered = true; | 9 mutationsDelivered = true; |
10 } | 10 } |
11 | 11 |
12 var observer = new MutationObserver(callback); | 12 var observer = new MutationObserver(callback); |
13 var div = document.createElement('div'); | 13 var div = document.createElement('div'); |
14 observer.observe(div, {attributes: true}); | 14 observer.observe(div, {attributes: true}); |
15 div.setAttribute('foo', 'bar'); | 15 div.setAttribute('foo', 'bar'); |
16 assert.notOk(mutationsDelivered); | 16 assert.notOk(mutationsDelivered); |
17 var scriptDidRun = false; | 17 var scriptDidRun = false; |
18 var script = document.createElement('script'); | 18 var script = document.createElement('script'); |
19 script.textContent = 'scriptDidRun = true'; | 19 script.textContent = 'scriptDidRun = true'; |
20 assert.notOk(scriptDidRun); | 20 assert.notOk(scriptDidRun); |
21 document.documentElement.appendChild(script); | 21 document.documentElement.appendChild(script); |
22 assert.notOk(scriptDidRun); | 22 assert.notOk(scriptDidRun); |
23 assert.notOk(mutationsDelivered); | 23 assert.notOk(mutationsDelivered); |
24 }); | 24 }); |
25 }); | 25 }); |
26 </script> | 26 </script> |
27 </html> | 27 </html> |
OLD | NEW |