use-hidden-attr-change.html (973B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <title>use element reacts to attribute changes when it's not rendered</title> 4 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> 5 <link rel="help" href="https://svgwg.org/svg2-draft/struct.html#UseElement"> 6 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1502658"> 7 <link rel="match" href="/svg/linking/reftests/use-descendant-combinator-ref.html"> 8 <style> 9 </style> 10 <p> 11 You should see a green square, and no red. 12 </p> 13 <svg 14 version="1.1" 15 xmlns="http://www.w3.org/2000/svg" 16 xmlns:xlink="http://www.w3.org/1999/xlink" 17 style="display: none"> 18 <defs> 19 <g id="square"> 20 <rect width="100" height="100" fill="green" /> 21 </g> 22 </defs> 23 <g id="test"> 24 <use /> 25 </g> 26 </svg> 27 <script> 28 onload = () => { 29 document.querySelector("use").setAttributeNS("http://www.w3.org/1999/xlink", "href", "#square"); 30 document.querySelector("svg").style.display = ""; 31 } 32 </script>