OLD | NEW |
1 // [Name] SVGUseElement-dom-href1-attr.js | 1 // [Name] SVGUseElement-dom-href1-attr.js |
2 // [Expected rendering result] A use element first with an internal then with an
external referenced document - and a series of PASS messages | 2 // [Expected rendering result] A use element first with an internal then with an
external referenced document - and a series of PASS messages |
3 | 3 |
4 description("Tests dynamic updates of the 'href' attribute of the SVGUseElement
object") | 4 description("Tests dynamic updates of the 'href' attribute of the SVGUseElement
object") |
5 createSVGTestCase(); | 5 createSVGTestCase(); |
6 | 6 |
7 var defsElement = createSVGElement("defs"); | 7 var defsElement = createSVGElement("defs"); |
8 rootSVGElement.appendChild(defsElement); | 8 rootSVGElement.appendChild(defsElement); |
9 | 9 |
10 var useElement = createSVGElement("use"); | 10 var useElement = createSVGElement("use"); |
11 useElement.setAttribute("x", "10"); | 11 useElement.setAttribute("x", "10"); |
12 useElement.setAttribute("y", "10"); | 12 useElement.setAttribute("y", "10"); |
13 useElement.setAttribute("externalResourcesRequired", "true"); | |
14 useElement.setAttribute("onload", "completeTest()"); | 13 useElement.setAttribute("onload", "completeTest()"); |
15 useElement.setAttributeNS(xlinkNS, "xlink:href", "#MyRect"); | 14 useElement.setAttributeNS(xlinkNS, "xlink:href", "#MyRect"); |
16 | 15 |
17 var rectElement = createSVGElement("rect"); | 16 var rectElement = createSVGElement("rect"); |
18 rectElement.setAttribute("id", "MyRect"); | 17 rectElement.setAttribute("id", "MyRect"); |
19 rectElement.setAttribute("x", "64"); | 18 rectElement.setAttribute("x", "64"); |
20 rectElement.setAttribute("y", "0"); | 19 rectElement.setAttribute("y", "0"); |
21 rectElement.setAttribute("width", "64"); | 20 rectElement.setAttribute("width", "64"); |
22 rectElement.setAttribute("height", "64"); | 21 rectElement.setAttribute("height", "64"); |
23 rectElement.setAttribute("fill", "red"); | 22 rectElement.setAttribute("fill", "red"); |
24 | 23 |
25 defsElement.appendChild(rectElement); | 24 defsElement.appendChild(rectElement); |
26 defsElement.appendChild(useElement); | 25 defsElement.appendChild(useElement); |
27 | 26 |
28 rootSVGElement.setAttribute("height", "200"); | 27 rootSVGElement.setAttribute("height", "200"); |
29 rootSVGElement.appendChild(useElement); | 28 rootSVGElement.appendChild(useElement); |
30 | 29 |
31 shouldBeEqualToString("useElement.getAttributeNS('" + xlinkNS + "', 'href')", "#
MyRect"); | 30 shouldBeEqualToString("useElement.getAttributeNS('" + xlinkNS + "', 'href')", "#
MyRect"); |
32 | 31 |
33 function repaintTest() { | 32 function repaintTest() { |
34 useElement.setAttributeNS(xlinkNS, "xlink:href", "../custom/resources/rgb.sv
g#G"); | 33 useElement.setAttributeNS(xlinkNS, "xlink:href", "../custom/resources/rgb.sv
g#G"); |
35 shouldBeEqualToString("useElement.getAttributeNS('" + xlinkNS + "', 'href')"
, "../custom/resources/rgb.svg#G"); | 34 shouldBeEqualToString("useElement.getAttributeNS('" + xlinkNS + "', 'href')"
, "../custom/resources/rgb.svg#G"); |
36 } | 35 } |
37 | 36 |
38 var successfullyParsed = true; | 37 var successfullyParsed = true; |
OLD | NEW |