• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" standalone="no"?>
2<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3<svg id="svg" viewBox="0 0 100 30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
4<defs>
5    <rect id="rect" width="60" height="10"/>
6</defs>
7
8<text x="30" y="30" transform="scale(0.2 0.2)">Hover over the rectangle - it should not crash</text>
9<use id="use" x="20" y="10" xlink:href="#rect" />
10
11<script>
12<![CDATA[
13    var svg = document.getElementById("svg");
14    var use = document.getElementById("use");
15
16    function addUseElement() {
17        svg.appendChild(use, true);
18        setTimeout(removeUseElement, 50);
19    }
20
21    function removeUseElement() {
22        use.parentElement.removeChild(use);
23        setTimeout(addUseElement, 50);
24    }
25
26    document.addEventListener("DOMNodeInserted", function() {}, true);
27    removeUseElement();
28]]>
29</script>
30</svg>
31