OLD | NEW |
1 <html> | 1 <html> |
2 <import src="../resources/chai.sky" /> | 2 <import src="../resources/chai.sky" /> |
3 <import src="../resources/mocha.sky" /> | 3 <import src="../resources/mocha.sky" /> |
4 <body id="body"> | 4 <body id="body"> |
5 <script> | 5 <script> |
6 document.body = document.getElementById("body"); | 6 document.body = document.getElementById("body"); |
7 | 7 |
8 describe('MutationObserver on character data', function() { | 8 describe('MutationObserver on character data', function() { |
9 it('should handle basic aspects of characterData observation', function(done
) { | 9 it('should handle basic aspects of characterData observation', function(done
) { |
10 var observer; | 10 var observer; |
(...skipping 23 matching lines...) Expand all Loading... |
34 mutations = null; | 34 mutations = null; |
35 observer.disconnect(); | 35 observer.disconnect(); |
36 charDataNode.textContent = 'baz'; | 36 charDataNode.textContent = 'baz'; |
37 setTimeout(checkNotDeliveredAndMutateMultiple, 0); | 37 setTimeout(checkNotDeliveredAndMutateMultiple, 0); |
38 } | 38 } |
39 | 39 |
40 function checkNotDeliveredAndMutateMultiple() { | 40 function checkNotDeliveredAndMutateMultiple() { |
41 // ...observer.disconnect() should prevent further delivery of mutat
ions. | 41 // ...observer.disconnect() should prevent further delivery of mutat
ions. |
42 | 42 |
43 assert.equal(mutations, null); | 43 assert.equal(mutations, null); |
44 charDataNode = document.createTextNode(''); | 44 charDataNode = new Text(''); |
45 observer.observe(charDataNode, { characterData: true }); | 45 observer.observe(charDataNode, { characterData: true }); |
46 charDataNode.textContent = 'foo'; | 46 charDataNode.textContent = 'foo'; |
47 charDataNode.textContent = 'bar'; | 47 charDataNode.textContent = 'bar'; |
48 setTimeout(finish); | 48 setTimeout(finish); |
49 } | 49 } |
50 | 50 |
51 function finish() { | 51 function finish() { |
52 // ...re-observing after disconnect works with the same observer. | 52 // ...re-observing after disconnect works with the same observer. |
53 | 53 |
54 assert.equal(mutations.length, 2); | 54 assert.equal(mutations.length, 2); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 assert.equal(mutations[0].oldValue, "foo"); | 220 assert.equal(mutations[0].oldValue, "foo"); |
221 observer.disconnect(); | 221 observer.disconnect(); |
222 done(); | 222 done(); |
223 } | 223 } |
224 | 224 |
225 start(); | 225 start(); |
226 }); | 226 }); |
227 }); | 227 }); |
228 </script> | 228 </script> |
229 </html> | 229 </html> |
OLD | NEW |