OLD | NEW |
| (Empty) |
1 <html> | |
2 <link rel="import" href="../resources/chai.html" /> | |
3 <link rel="import" href="../resources/mocha.html" /> | |
4 <script> | |
5 describe('MutationObserver wrappers', function() { | |
6 it('should survive GC for passing into the callback even if JS has lost refe
rences and the only remaining observations are transient.', function(done) { | |
7 function addObserver(node, fn) { | |
8 var observer = new MutationObserver(fn); | |
9 observer.testProperty = true; | |
10 observer.observe(node, {attributes:true, subtree: true}); | |
11 } | |
12 | |
13 var root = document.createElement('div'); | |
14 var child = root.appendChild(document.createElement('span')); | |
15 addObserver(root, function(records, observer) { | |
16 window.observer = observer; | |
17 assert.ok(observer.testProperty); | |
18 done(); | |
19 }); | |
20 | |
21 root.removeChild(child); | |
22 child.setAttribute('foo', 'bar'); | |
23 root = null; | |
24 | |
25 gc(); | |
26 }); | |
27 }); | |
28 </script> | |
29 </html> | |
OLD | NEW |