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 <div id="range"></div> | 4 <div id="range"></div> |
5 <script> | 5 <script> |
6 describe('MutationObservers', function() { | 6 describe('MutationObservers', function() { |
7 it('should handle shadow dom', function() { | 7 it('should handle shadow dom', function() { |
8 function mutate(element) { | 8 function mutate(element) { |
9 element.setAttribute('data-foo', 'bar'); | 9 element.setAttribute('data-foo', 'bar'); |
10 element.insertBefore(document.createTextNode('hello'), element.firstChild)
; | 10 element.insertBefore(document.createTextNode('hello'), element.firstChild)
; |
11 element.firstChild.textContent = 'goodbye'; | 11 element.firstChild.textContent = 'goodbye'; |
12 element.removeChild(element.firstChild); | 12 element.removeChild(element.firstChild); |
13 } | 13 } |
(...skipping 17 matching lines...) Expand all Loading... |
31 | 31 |
32 mutations = observer.takeRecords(); | 32 mutations = observer.takeRecords(); |
33 observer.observe(document, {attributes: true, childList: true, characterData
: true, subtree: true}); | 33 observer.observe(document, {attributes: true, childList: true, characterData
: true, subtree: true}); |
34 mutate(shadowRoot.firstChild); | 34 mutate(shadowRoot.firstChild); |
35 // Observing from outside shadow DOM should not see mutations in the shadow: | 35 // Observing from outside shadow DOM should not see mutations in the shadow: |
36 assert.equal(mutations.length, 0); | 36 assert.equal(mutations.length, 0); |
37 }); | 37 }); |
38 }); | 38 }); |
39 </script> | 39 </script> |
40 </html> | 40 </html> |
OLD | NEW |