| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>SVG*List immutability</title> | 2 <title>SVG*List immutability</title> |
| 3 <script src=../../resources/testharness.js></script> | 3 <script src=../../resources/testharness.js></script> |
| 4 <script src=../../resources/testharnessreport.js></script> | 4 <script src=../../resources/testharnessreport.js></script> |
| 5 <script> | 5 <script> |
| 6 var root = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); | 6 var root = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); |
| 7 [ | 7 [ |
| 8 { | 8 { |
| 9 element: 'path', attr: 'd', value: 'M0,0l10,10', listName: 'SVGPathSegLi
st', | |
| 10 accessor: function(elm) { return elm.animatedPathSegList; }, | |
| 11 constructItem: function(elm) { return elm.createSVGPathSegLinetoAbs(20,
20); } | |
| 12 }, { | |
| 13 element: 'polygon', attr: 'points', value: '0,0 10,10', listName: 'SVGPo
intList', | 9 element: 'polygon', attr: 'points', value: '0,0 10,10', listName: 'SVGPo
intList', |
| 14 accessor: function(elm) { return elm.animatedPoints; }, | 10 accessor: function(elm) { return elm.animatedPoints; }, |
| 15 constructItem: function(elm) { return root.createSVGPoint(); } | 11 constructItem: function(elm) { return root.createSVGPoint(); } |
| 16 }, { | 12 }, { |
| 17 element: 'text', attr: 'x', value: '0 10', listName: 'SVGLengthList', | 13 element: 'text', attr: 'x', value: '0 10', listName: 'SVGLengthList', |
| 18 accessor: function(elm) { return elm.x.animVal; }, | 14 accessor: function(elm) { return elm.x.animVal; }, |
| 19 constructItem: function(elm) { return root.createSVGLength(); } | 15 constructItem: function(elm) { return root.createSVGLength(); } |
| 20 }, { | 16 }, { |
| 21 element: 'rect', attr: 'transform', value: 'rotate(0) scale(1)', listNam
e: 'SVGTransformList', | 17 element: 'rect', attr: 'transform', value: 'rotate(0) scale(1)', listNam
e: 'SVGTransformList', |
| 22 accessor: function(elm) { return elm.transform.animVal; }, | 18 accessor: function(elm) { return elm.transform.animVal; }, |
| 23 constructItem: function(elm) { return root.createSVGTransform(); } | 19 constructItem: function(elm) { return root.createSVGTransform(); } |
| 24 } | 20 } |
| 25 ].forEach(function(testItem) { | 21 ].forEach(function(testItem) { |
| 26 var element = document.createElementNS('http://www.w3.org/2000/svg', testIte
m.element); | 22 var element = document.createElementNS('http://www.w3.org/2000/svg', testIte
m.element); |
| 27 element.setAttribute(testItem.attr, testItem.value); | 23 element.setAttribute(testItem.attr, testItem.value); |
| 28 var list = testItem.accessor(element); | 24 var list = testItem.accessor(element); |
| 29 var item = testItem.constructItem(element); | 25 var item = testItem.constructItem(element); |
| 30 test(function() { | 26 test(function() { |
| 31 assert_equals(list.length, 2); | 27 assert_equals(list.length, 2); |
| 32 assert_throws('NoModificationAllowedError', function() { list.clear(); }
); | 28 assert_throws('NoModificationAllowedError', function() { list.clear(); }
); |
| 33 assert_throws('NoModificationAllowedError', function() { list.initialize
(item); }); | 29 assert_throws('NoModificationAllowedError', function() { list.initialize
(item); }); |
| 34 assert_throws('NoModificationAllowedError', function() { list[0] = item;
}); | 30 assert_throws('NoModificationAllowedError', function() { list[0] = item;
}); |
| 35 assert_throws('NoModificationAllowedError', function() { list.insertItem
Before(item, 0); }); | 31 assert_throws('NoModificationAllowedError', function() { list.insertItem
Before(item, 0); }); |
| 36 assert_throws('NoModificationAllowedError', function() { list.replaceIte
m(item, 0); }); | 32 assert_throws('NoModificationAllowedError', function() { list.replaceIte
m(item, 0); }); |
| 37 assert_throws('NoModificationAllowedError', function() { list.removeItem
(0); }); | 33 assert_throws('NoModificationAllowedError', function() { list.removeItem
(0); }); |
| 38 assert_throws('NoModificationAllowedError', function() { list.appendItem
(item); }); | 34 assert_throws('NoModificationAllowedError', function() { list.appendItem
(item); }); |
| 39 }, document.title + ', ' + testItem.listName); | 35 }, document.title + ', ' + testItem.listName); |
| 40 }); | 36 }); |
| 41 </script> | 37 </script> |
| OLD | NEW |