dynamic-clipPath-02.svg 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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" version="1.1"
  6. class="reftest-wait"
  7. onload="startTest()"
  8. xmlns:xlink="http://www.w3.org/1999/xlink">
  9. <title>Testing that dynamic changes to the clipPathUnits are reflected in the clipPath</title>
  10. <defs>
  11. <clipPath id="clip1" clipPathUnits="objectBoundingBox">
  12. <rect width=".1" height=".1"/>
  13. </clipPath>
  14. </defs>
  15. <rect width="100%" height="100%" fill="lime"/>
  16. <g transform="scale(1000)">
  17. <rect x=".2" y=".2" width=".6" height=".6" fill="red" clip-path="url(#clip1)"/>
  18. </g>
  19. <script>
  20. function startTest() {
  21. document.addEventListener("MozReftestInvalidate", doTest, false);
  22. setTimeout(doTest, 4000); // fallback for running outside reftest
  23. }
  24. function doTest() {
  25. var clip1 = document.getElementById("clip1");
  26. clip1.clipPathUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE;
  27. document.documentElement.removeAttribute("class");
  28. }
  29. </script>
  30. </svg>