blob: 064c550e4cc2b2fe9d45b6e2fd7dfa968b432ad8 [file] [log] [blame]
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<svg id="green-svg" width="100" height="100">
<defs>
<rect id="green-rect" fill="green" width="100" height="100"/>
</defs>
<use id="use-green-rect" xlink:href="#green-rect"/>
</svg>
</defs>
<use id="use-green-svg" x="10" y="10" xlink:href="#green-svg"/>
<text>Pass.</text>
<script>
if (window.testRunner)
testRunner.dumpAsText();
var onAlert = function() {
alert("test");
}
// This removeEventListener() has to be called before the onload fires. Before
// onload fires, the shadow tree of the SVGUseElement is not built. So this
// call should affect the original element only. Once the shadow tree is built,
// the SVGUseElement calls updateShadowTree() and this is where we want to make
// sure the eventListeners of all the cloned elements in the shadow tree are
// updated correctly and the disallowed cloned elements and their descendants
// are disconnected from their corresponding elements.
document.getElementById("green-rect").addEventListener("click", onAlert);
window.addEventListener("load", function () {
document.getElementById("green-rect").removeEventListener("click", onAlert);
}, false);
</script>
</svg>