| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/js-test.js"></script> | 2 <script src="../../../resources/js-test.js"></script> |
| 3 <script> | 3 <script> |
| 4 | 4 |
| 5 window.jsTestIsAsync = true; | 5 window.jsTestIsAsync = true; |
| 6 var mutations, mutations2, mutationsWithOldValue; | 6 var mutations, mutations2, mutationsWithOldValue; |
| 7 var calls; | 7 var calls; |
| 8 var div; | 8 var div; |
| 9 | 9 |
| 10 function testBasic() { | 10 function testBasic() { |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 shouldBe('mutations[0].oldValue', '"foo"'); | 796 shouldBe('mutations[0].oldValue', '"foo"'); |
| 797 | 797 |
| 798 observer.disconnect(); | 798 observer.disconnect(); |
| 799 debug(''); | 799 debug(''); |
| 800 runNextTest(); | 800 runNextTest(); |
| 801 } | 801 } |
| 802 | 802 |
| 803 start(); | 803 start(); |
| 804 } | 804 } |
| 805 | 805 |
| 806 function testMutateThroughAttrNodeChild() { | |
| 807 var observer; | |
| 808 | |
| 809 function start() { | |
| 810 debug('Test that mutating an attribute by attaching a child to an attr n
ode delivers mutation records'); | |
| 811 | |
| 812 mutations = null; | |
| 813 observer = new MutationObserver(function(mutations) { | |
| 814 window.mutations = mutations; | |
| 815 }); | |
| 816 | |
| 817 div = document.createElement('div'); | |
| 818 div.setAttribute('data-test', 'foo'); | |
| 819 observer.observe(div, { attributes: true, attributeOldValue: true }); | |
| 820 div.attributes['data-test'].appendChild(document.createTextNode('bar')); | |
| 821 | |
| 822 setTimeout(finish, 0); | |
| 823 } | |
| 824 | |
| 825 function finish() { | |
| 826 shouldBe('mutations.length', '1'); | |
| 827 shouldBe('mutations[0].target', 'div'); | |
| 828 shouldBe('mutations[0].type', '"attributes"'); | |
| 829 shouldBe('mutations[0].attributeName', '"data-test"'); | |
| 830 shouldBe('mutations[0].oldValue', '"foo"'); | |
| 831 | |
| 832 observer.disconnect(); | |
| 833 debug(''); | |
| 834 runNextTest(); | |
| 835 } | |
| 836 | |
| 837 start(); | |
| 838 } | |
| 839 | |
| 840 function testSetAndRemoveAttributeNode() { | 806 function testSetAndRemoveAttributeNode() { |
| 841 var observer; | 807 var observer; |
| 842 | 808 |
| 843 function start() { | 809 function start() { |
| 844 debug('Test that mutating via setAttributeNode delivers mutation records
'); | 810 debug('Test that mutating via setAttributeNode delivers mutation records
'); |
| 845 | 811 |
| 846 mutations = null; | 812 mutations = null; |
| 847 observer = new MutationObserver(function(mutations) { | 813 observer = new MutationObserver(function(mutations) { |
| 848 window.mutations = mutations; | 814 window.mutations = mutations; |
| 849 }); | 815 }); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 testOldValueUnionMultipleObservations, | 942 testOldValueUnionMultipleObservations, |
| 977 testIDLAttribute, | 943 testIDLAttribute, |
| 978 testAttributeFilter, | 944 testAttributeFilter, |
| 979 testAttributeFilterSubtree, | 945 testAttributeFilterSubtree, |
| 980 testAttributeFilterNonHTMLElement, | 946 testAttributeFilterNonHTMLElement, |
| 981 testAttributeFilterNonHTMLDocument, | 947 testAttributeFilterNonHTMLDocument, |
| 982 testStyleAttributePropertyAccess, | 948 testStyleAttributePropertyAccess, |
| 983 testStyleAttributePropertyAccessOldValue, | 949 testStyleAttributePropertyAccessOldValue, |
| 984 testStyleAttributePropertyAccessIgnoreNoop, | 950 testStyleAttributePropertyAccessIgnoreNoop, |
| 985 testMutateThroughAttrNodeValue, | 951 testMutateThroughAttrNodeValue, |
| 986 testMutateThroughAttrNodeChild, | |
| 987 testSetAndRemoveAttributeNode, | 952 testSetAndRemoveAttributeNode, |
| 988 testMixedNodeAndElementOperations, | 953 testMixedNodeAndElementOperations, |
| 989 testNamedNodeMapOperations | 954 testNamedNodeMapOperations |
| 990 ]; | 955 ]; |
| 991 var testIndex = 0; | 956 var testIndex = 0; |
| 992 | 957 |
| 993 function runNextTest() { | 958 function runNextTest() { |
| 994 if (testIndex < tests.length) | 959 if (testIndex < tests.length) |
| 995 tests[testIndex++](); | 960 tests[testIndex++](); |
| 996 else | 961 else |
| 997 finishJSTest(); | 962 finishJSTest(); |
| 998 } | 963 } |
| 999 | 964 |
| 1000 description('Test WebKitMutationObserver.observe on attributes'); | 965 description('Test WebKitMutationObserver.observe on attributes'); |
| 1001 | 966 |
| 1002 runNextTest(); | 967 runNextTest(); |
| 1003 </script> | 968 </script> |
| OLD | NEW |