dynamic-use-04.svg 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. <!--
  2. Any copyright is dedicated to the Public Domain.
  3. http://creativecommons.org/publicdomain/zero/1.0/
  4. -->
  5. <svg xmlns="http://www.w3.org/2000/svg"
  6. xmlns:xlink="http://www.w3.org/1999/xlink"
  7. style="background: red;" class="reftest-wait">
  8. <defs>
  9. <rect fill="lime" width="100%" height="100%" id="r"/>
  10. </defs>
  11. <use id="u" xlink:href="#r" width="0" />
  12. <script type="text/javascript">
  13. <![CDATA[
  14. document.addEventListener("MozReftestInvalidate", doTest, false);
  15. setTimeout(doTest, 4000); // fallback for running outside reftest
  16. function doTest() {
  17. // Since the <use> does not reference an <svg> or <symbol>, the value
  18. // of its 'width' attribute is ignored except to disable/enable its
  19. // rendering by setting it to zero/non-zero. Setting it to a non-zero
  20. // value here should show the entire referenced <rect>. See
  21. // http://www.w3.org/TR/SVG11/struct.html#UseElement
  22. var u = document.getElementById("u");
  23. u.setAttribute("width", "1");
  24. document.documentElement.removeAttribute('class');
  25. }
  26. ]]>
  27. </script>
  28. </svg>