dynamic-switch-01.svg 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?xml version="1.0"?>
  2. <!--
  3. Any copyright is dedicated to the Public Domain.
  4. http://creativecommons.org/publicdomain/zero/1.0/
  5. -->
  6. <svg version="1.1" xmlns="http://www.w3.org/2000/svg" onload="m();">
  7. <title>Testcase for dynamic switch changes</title>
  8. <!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=409383 -->
  9. <script>
  10. function m() {
  11. var svgns = "http://www.w3.org/2000/svg";
  12. var rect1 = document.getElementById("rect1");
  13. rect1.parentNode.removeChild(rect1);
  14. var rect2a = document.createElementNS(svgns, "rect");
  15. rect2a.setAttribute("x", "200");
  16. rect2a.setAttribute("y", "100");
  17. rect2a.setAttribute("width", "50");
  18. rect2a.setAttribute("height", "50")
  19. rect2a.setAttribute("fill", "lime");
  20. var rect2b = document.getElementById("rect2b");
  21. rect2b.parentNode.insertBefore(rect2a, rect2b);
  22. var rect3a = document.getElementById("rect3a");
  23. var rect3b = document.getElementById("rect3b");
  24. rect3a.parentNode.insertBefore(rect3a, rect3b);
  25. var rect4a = document.getElementById("rect4a");
  26. rect4a.setAttribute("systemLanguage", "foo");
  27. }
  28. </script>
  29. <rect width="100%" height="100%" fill="lime"/>
  30. <switch>
  31. <!-- test removing first child -->
  32. <rect id="rect1" x="50" y="100" width="50" height="50" fill="red"/>
  33. <rect x="50" y="100" width="50" height="50" fill="lime"/>
  34. <rect x="50" y="100" width="50" height="50" fill="red"/>
  35. </switch>
  36. <switch>
  37. <!-- test adding first child -->
  38. <rect id="rect2b" x="200" y="100" width="50" height="50" fill="red"/>
  39. </switch>
  40. <switch>
  41. <!-- test change child order -->
  42. <rect id="rect3b" x="50" y="200" width="50" height="50" fill="red"/>
  43. <rect id="rect3a" x="50" y="200" width="50" height="50" fill="lime"/>
  44. </switch>
  45. <switch>
  46. <!-- test change child attribute -->
  47. <rect id="rect4a" x="200" y="200" width="50" height="50" fill="red"/>
  48. <rect x="200" y="200" width="50" height="50" fill="lime"/>
  49. </switch>
  50. </svg>