blob: a55c8b98d91ed8f3f0cc49ad0825536ba62822f5 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="resources/SVGTestCase.js"></script>
<script src="../../resources/js-test-pre.js"></script>
<script src="../../fast/repaint/resources/repaint.js"></script>
</head>
<body onload="runRepaintTest()">
<h1>SVG 1.1 dynamic update tests</h1>
<p id="description"></p>
<div id="console"></div>
<script>
// [Name] SVGUseElement-dom-href2-attr.js
// [Expected rendering result] A use element first with an external then with an internal referenced document - and a series of PASS messages
description("Tests dynamic updates of the 'href' attribute of the SVGUseElement object")
createSVGTestCase();
var defsElement = createSVGElement("defs");
rootSVGElement.appendChild(defsElement);
var useElement = createSVGElement("use");
useElement.setAttribute("x", "10");
useElement.setAttribute("y", "10");
useElement.setAttribute("externalResourcesRequired", "true");
useElement.setAttribute("onload", "externalLoadDone()");
var rectElement = createSVGElement("rect");
rectElement.setAttribute("id", "MyRect");
rectElement.setAttribute("x", "0");
rectElement.setAttribute("y", "0");
rectElement.setAttribute("width", "64");
rectElement.setAttribute("height", "64");
rectElement.setAttribute("fill", "green");
defsElement.appendChild(rectElement);
rootSVGElement.setAttribute("height", "200");
rootSVGElement.appendChild(useElement);
function repaintTest() {
// Start loading external resource, wait for it, then switch back to internal.
useElement.setAttributeNS(xlinkNS, "xlink:href", "../custom/resources/rgb.svg#R");
}
function externalLoadDone() {
useElement.setAttributeNS(xlinkNS, "xlink:href", "#MyRect");
shouldBeEqualToString("useElement.getAttributeNS('" + xlinkNS + "', 'href')", "#MyRect");
completeTest();
}
var successfullyParsed = true;
</script>
</body>
</html>