2 <script src=
"../../../resources/js-test.js"></script>
4 description('Non-relevant properties on mutation records should be null, except for NodeLists, which should be empty');
5 var observer
= new MutationObserver(function() {});
7 var text
= document
.createTextNode('something');
8 observer
.observe(text
, {characterData
: true});
9 text
.data
= 'something else';
10 var record
= observer
.takeRecords()[0];
11 debug('characterData record:');
12 shouldBeNull('record.attributeName');
13 shouldBeNull('record.attributeNamespace');
14 shouldBeNull('record.oldValue');
15 shouldBeNull('record.previousSibling');
16 shouldBeNull('record.nextSibling');
17 shouldBe('record.addedNodes.length', '0');
18 shouldBe('record.removedNodes.length', '0');
20 var div
= document
.createElement('div');
21 observer
.observe(div
, {childList
: true});
22 div
.appendChild(document
.createElement('span'));
23 record
= observer
.takeRecords()[0];
24 debug('\nchildList record:');
25 shouldBeNull('record.attributeName');
26 shouldBeNull('record.attributeNamespace');
27 shouldBeNull('record.oldValue');
29 observer
.observe(div
, {attributes
: true});
30 div
.setAttribute('data-foo', 'bar');
31 record
= observer
.takeRecords()[0];
32 debug('\nattributes record:');
33 shouldBeNull('record.attributeNamespace');
34 shouldBeNull('record.oldValue');
35 shouldBeNull('record.previousSibling');
36 shouldBeNull('record.nextSibling');
37 shouldBe('record.addedNodes.length', '0');
38 shouldBe('record.removedNodes.length', '0');