OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <script src="../../../resources/js-test.js"></script> | |
3 <script> | |
4 | |
5 description('Test MutationObserver.observe options related to attributes'); | |
6 | |
7 var observer = new MutationObserver(function() {}); | |
8 var element = document.createElement('div'); | |
9 element.setAttribute('data-test', '1'); | |
10 | |
11 observer.observe(element, {attributeOldValue: true}); | |
12 element.setAttribute('data-test', '1'); | |
13 var records = observer.takeRecords(); | |
14 shouldBe('records.length', '1'); | |
15 shouldBeEqualToString('records[0].oldValue', '1'); | |
16 observer.disconnect(); | |
17 | |
18 observer.observe(element, {attributeOldValue: false}); | |
19 element.setAttribute('data-test', '1'); | |
20 var records = observer.takeRecords(); | |
21 shouldBe('records.length', '1'); | |
22 shouldBeNull('records[0].oldValue'); | |
23 observer.disconnect(); | |
24 | |
25 observer.observe(element, {attributeFilter: ['data-test']}); | |
26 element.setAttribute('data-test', '2'); | |
27 var records = observer.takeRecords(); | |
28 shouldBe('records.length', '1'); | |
29 shouldBeNull('records[0].oldValue'); | |
30 observer.disconnect(); | |
31 | |
32 </script> | |
OLD | NEW |