1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <svg xmlns=
"http://www.w3.org/2000/svg" onload=
"init()">
7 var point = document.rootElement.createSVGPoint();
11 document.getElementById(
"test1").setAttribute(
"fill",
"green");
14 document.getElementById(
"test2").setAttribute(
"fill",
"green");
17 // Assign new values from local function
21 document.getElementById(
"test3").setAttribute(
"fill",
"green");
24 document.getElementById(
"test4").setAttribute(
"fill",
"green");
27 // Assign new values from external function
30 document.getElementById(
"test5").setAttribute(
"fill",
"green");
33 document.getElementById(
"test6").setAttribute(
"fill",
"green");
36 // Create new point in external function, check values
37 var newPoint = createNewPoint();
38 if (newPoint.x ==
66) {
39 document.getElementById(
"test7").setAttribute(
"fill",
"green");
41 if (newPoint.y ==
666) {
42 document.getElementById(
"test8").setAttribute(
"fill",
"green");
45 // Check swapping of point objects
46 var savedPoint = point;
49 document.getElementById(
"test9").setAttribute(
"fill",
"green");
52 document.getElementById(
"test10").setAttribute(
"fill",
"green");
57 document.getElementById(
"test11").setAttribute(
"fill",
"green");
60 document.getElementById(
"test12").setAttribute(
"fill",
"green");
63 // Modifying savedPoint, should also modify point
68 document.getElementById(
"test13").setAttribute(
"fill",
"green");
71 document.getElementById(
"test14").setAttribute(
"fill",
"green");
75 function assignValues(p)
81 function createNewPoint()
83 var point = document.rootElement.createSVGPoint();
90 <rect id=
"test1" transform=
"translate(0, 0)" x=
"0" y=
"0" width=
"100" height=
"20" fill=
"red"/>
91 <rect id=
"test2" transform=
"translate(0, 30)" x=
"0" y=
"0" width=
"100" height=
"20" fill=
"red"/>
92 <rect id=
"test3" transform=
"translate(0, 60)" x=
"0" y=
"0" width=
"100" height=
"20" fill=
"red"/>
93 <rect id=
"test4" transform=
"translate(0, 90)" x=
"0" y=
"0" width=
"100" height=
"20" fill=
"red"/>
94 <rect id=
"test5" transform=
"translate(0, 120)" x=
"0" y=
"0" width=
"100" height=
"20" fill=
"red"/>
95 <rect id=
"test6" transform=
"translate(0, 150)" x=
"0" y=
"0" width=
"100" height=
"20" fill=
"red"/>
96 <rect id=
"test7" transform=
"translate(0, 180)" x=
"0" y=
"0" width=
"100" height=
"20" fill=
"red"/>
98 <rect id=
"test8" transform=
"translate(110, 0)" x=
"0" y=
"0" width=
"100" height=
"20" fill=
"red"/>
99 <rect id=
"test9" transform=
"translate(110, 30)" x=
"0" y=
"0" width=
"100" height=
"20" fill=
"red"/>
100 <rect id=
"test10" transform=
"translate(110, 60)" x=
"0" y=
"0" width=
"100" height=
"20" fill=
"red"/>
101 <rect id=
"test11" transform=
"translate(110, 90)" x=
"0" y=
"0" width=
"100" height=
"20" fill=
"red"/>
102 <rect id=
"test12" transform=
"translate(110, 120)" x=
"0" y=
"0" width=
"100" height=
"20" fill=
"red"/>
103 <rect id=
"test13" transform=
"translate(110, 150)" x=
"0" y=
"0" width=
"100" height=
"20" fill=
"red"/>
104 <rect id=
"test14" transform=
"translate(110, 180)" x=
"0" y=
"0" width=
"100" height=
"20" fill=
"red"/>