| OLD | NEW |
| 1 // [Name] SVGUseElement-dom-requiredFeatures.js | 1 // [Name] SVGUseElement-dom-requiredFeatures.js |
| 2 // [Expected rendering result] a series of PASS messages | 2 // [Expected rendering result] a series of PASS messages |
| 3 | 3 |
| 4 createSVGTestCase(); | 4 createSVGTestCase(); |
| 5 | 5 |
| 6 var useElement = createSVGElement("use"); | 6 var useElement = createSVGElement("use"); |
| 7 var defsElement = createSVGElement("defs"); | 7 var defsElement = createSVGElement("defs"); |
| 8 var rectElement = createSVGElement("rect"); | 8 var rectElement = createSVGElement("rect"); |
| 9 rectElement.setAttribute("width", "200"); | 9 rectElement.setAttribute("width", "200"); |
| 10 rectElement.setAttribute("height", "200"); | 10 rectElement.setAttribute("height", "200"); |
| 11 rectElement.setAttribute("id", "MyRect"); | 11 rectElement.setAttribute("id", "MyRect"); |
| 12 useElement.setAttributeNS(xlinkNS, "xlink:href", "#MyRect"); | 12 useElement.setAttributeNS(xlinkNS, "xlink:href", "#MyRect"); |
| 13 | 13 |
| 14 defsElement.appendChild(rectElement); | 14 defsElement.appendChild(rectElement); |
| 15 rootSVGElement.appendChild(defsElement); | 15 rootSVGElement.appendChild(defsElement); |
| 16 rootSVGElement.appendChild(useElement); | 16 rootSVGElement.appendChild(useElement); |
| 17 | 17 |
| 18 function repaintTest() { | 18 function repaintTest() { |
| 19 description("Check that SVGUseElement is initially displayed"); | 19 description("Check that SVGUseElement is initially displayed"); |
| 20 shouldBeEqualToString("document.defaultView.getComputedStyle(useElement, nul
l).display", "inline"); | 20 shouldBeEqualToString("document.defaultView.getComputedStyle(useElement, nul
l).display", "inline"); |
| 21 description("Check that setting requiredFeatures to something invalid makes
it not render"); | 21 description("Check that setting requiredFeatures to something invalid makes
it not render"); |
| 22 useElement.setAttribute("requiredFeatures", "foo"); | 22 useElement.setAttribute("requiredFeatures", "http://www.w3.org/TR/SVG11/feat
ure#BogusFeature"); |
| 23 shouldBeEqualToString("document.defaultView.getComputedStyle(useElement, nul
l).display", ""); | 23 shouldBeEqualToString("document.defaultView.getComputedStyle(useElement, nul
l).display", ""); |
| 24 description("Check that setting requiredFeatures to something valid makes it
render again"); | 24 description("Check that setting requiredFeatures to something valid makes it
render again"); |
| 25 useElement.setAttribute("requiredFeatures", "http://www.w3.org/TR/SVG11/feat
ure#Shape"); | 25 useElement.setAttribute("requiredFeatures", "http://www.w3.org/TR/SVG11/feat
ure#Shape"); |
| 26 shouldBeEqualToString("document.defaultView.getComputedStyle(useElement, nul
l).display", "inline"); | 26 shouldBeEqualToString("document.defaultView.getComputedStyle(useElement, nul
l).display", "inline"); |
| 27 debug("Check that adding something valid to requiredFeatures keeps rendering
the element"); | 27 debug("Check that adding something valid to requiredFeatures keeps rendering
the element"); |
| 28 useElement.setAttribute("requiredFeatures", "http://www.w3.org/TR/SVG11/feat
ure#Gradient"); | 28 useElement.setAttribute("requiredFeatures", "http://www.w3.org/TR/SVG11/feat
ure#Gradient"); |
| 29 shouldBeEqualToString("document.defaultView.getComputedStyle(useElement, nul
l).display", "inline"); | 29 shouldBeEqualToString("document.defaultView.getComputedStyle(useElement, nul
l).display", "inline"); |
| 30 debug("Check that adding something invalid to requiredFeatures makes it not
render"); | 30 debug("Check that adding something invalid to requiredFeatures makes it not
render"); |
| 31 useElement.setAttribute("requiredFeatures", "foo"); | 31 useElement.setAttribute("requiredFeatures", "http://www.w3.org/TR/SVG11/feat
ure#BogusFeature"); |
| 32 shouldBeEqualToString("document.defaultView.getComputedStyle(useElement, nul
l).display", ""); | 32 shouldBeEqualToString("document.defaultView.getComputedStyle(useElement, nul
l).display", ""); |
| 33 | 33 |
| 34 completeTest(); | 34 completeTest(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 var successfullyParsed = true; | 37 var successfullyParsed = true; |
| OLD | NEW |