<!DOCTYPE html>
<title>SVG*List immutability</title>
<script src=../../resources/testharness.js></script>
<script src=../../resources/testharnessreport.js></script>
<script>
var root = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
[
{
element: 'polygon', attr: 'points', value: '0,0 10,10', listName: 'SVGPointList',
accessor: function(elm) { return elm.animatedPoints; },
constructItem: function(elm) { return root.createSVGPoint(); }
}, {
element: 'text', attr: 'x', value: '0 10', listName: 'SVGLengthList',
accessor: function(elm) { return elm.x.animVal; },
constructItem: function(elm) { return root.createSVGLength(); }
}, {
element: 'rect', attr: 'transform', value: 'rotate(0) scale(1)', listName: 'SVGTransformList',
accessor: function(elm) { return elm.transform.animVal; },
constructItem: function(elm) { return root.createSVGTransform(); }
}
].forEach(function(testItem) {
var element = document.createElementNS('http://www.w3.org/2000/svg', testItem.element);
element.setAttribute(testItem.attr, testItem.value);
var list = testItem.accessor(element);
var item = testItem.constructItem(element);
test(function() {
assert_equals(list.length, 2);
assert_throws_dom('NoModificationAllowedError', function() { list.clear(); });
assert_throws_dom('NoModificationAllowedError', function() { list.initialize(item); });
assert_throws_dom('NoModificationAllowedError', function() { list[0] = item; });
assert_throws_dom('NoModificationAllowedError', function() { list.insertItemBefore(item, 0); });
assert_throws_dom('NoModificationAllowedError', function() { list.replaceItem(item, 0); });
assert_throws_dom('NoModificationAllowedError', function() { list.removeItem(0); });
assert_throws_dom('NoModificationAllowedError', function() { list.appendItem(item); });
}, document.title + ', ' + testItem.listName);
});
</script>