OLD | NEW |
1 // [Name] SVGUseElement-svgdom-href2-prop.js | 1 // [Name] SVGUseElement-svgdom-href2-prop.js |
2 // [Expected rendering result] A use element first with an external then with an
internal referenced document - and a series of PASS messages | 2 // [Expected rendering result] A use element first with an external then with an
internal referenced document - and a series of PASS messages |
3 | 3 |
4 description("Tests dynamic updates of the 'href' property of the SVGUseElement o
bject") | 4 description("Tests dynamic updates of the 'href' property of the SVGUseElement o
bject") |
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", "externalLoadDone()"); | 13 useElement.setAttribute("onload", "externalLoadDone()"); |
15 | 14 |
16 var rectElement = createSVGElement("rect"); | 15 var rectElement = createSVGElement("rect"); |
17 rectElement.setAttribute("id", "MyRect"); | 16 rectElement.setAttribute("id", "MyRect"); |
18 rectElement.setAttribute("x", "0"); | 17 rectElement.setAttribute("x", "0"); |
19 rectElement.setAttribute("y", "0"); | 18 rectElement.setAttribute("y", "0"); |
20 rectElement.setAttribute("width", "64"); | 19 rectElement.setAttribute("width", "64"); |
21 rectElement.setAttribute("height", "64"); | 20 rectElement.setAttribute("height", "64"); |
22 rectElement.setAttribute("fill", "green"); | 21 rectElement.setAttribute("fill", "green"); |
23 | 22 |
24 defsElement.appendChild(rectElement); | 23 defsElement.appendChild(rectElement); |
25 | 24 |
26 rootSVGElement.setAttribute("height", "200"); | 25 rootSVGElement.setAttribute("height", "200"); |
27 rootSVGElement.appendChild(useElement); | 26 rootSVGElement.appendChild(useElement); |
28 | 27 |
29 function repaintTest() { | 28 function repaintTest() { |
30 // Start loading external resource, wait for it, then switch back to interna
l. | 29 // Start loading external resource, wait for it, then switch back to interna
l. |
31 useElement.setAttributeNS(xlinkNS, "xlink:href", "../custom/resources/rgb.sv
g#R"); | 30 useElement.setAttributeNS(xlinkNS, "xlink:href", "../custom/resources/rgb.sv
g#R"); |
32 } | 31 } |
33 | 32 |
34 function externalLoadDone() { | 33 function externalLoadDone() { |
35 useElement.href.baseVal = "#MyRect"; | 34 useElement.href.baseVal = "#MyRect"; |
36 shouldBeEqualToString("useElement.href.baseVal", "#MyRect"); | 35 shouldBeEqualToString("useElement.href.baseVal", "#MyRect"); |
37 | 36 |
38 completeTest(); | 37 completeTest(); |
39 } | 38 } |
40 | 39 |
41 var successfullyParsed = true; | 40 var successfullyParsed = true; |
OLD | NEW |