<!DOCTYPE html> | |
<svg> | |
<defs> | |
<rect id="rect" width="50" height="100" fill="green"/> | |
</defs> | |
<use id="inner" href="#rect"/> | |
<use href="#inner" x="50"/> | |
</svg> | |
<script> | |
onload = function() { | |
// Make sure the shadow tree have been instantiated. | |
document.body.offsetTop; | |
let inner = document.querySelector('#inner'); | |
inner.setAttribute('href', location.href + '#rect'); | |
}; | |
</script> |