test_bug874919.html 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=874919
  5. -->
  6. <head>
  7. <title>Test for Bug 874919</title>
  8. <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
  9. <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  10. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
  11. </head>
  12. <body>
  13. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=874919">Mozilla Bug 874919</a>
  14. <p id="display"></p>
  15. <div id="content" style="width: 150px">
  16. <svg id="outer_SVG" style="display: inline; width: 100%">
  17. <circle cx="120" cy="120" r="120" fill="blue"></circle>
  18. <svg id="inner_SVG">
  19. <circle id="circle" cx="120" cy="120" r="120" fill="red"></circle>
  20. </svg>
  21. </svg>
  22. </div>
  23. <pre id="test">
  24. <script type="text/javascript">
  25. var shouldUseComputed = ["inner_SVG"]
  26. var shouldUseUsed = ["outer_SVG"]
  27. shouldUseUsed.forEach(function(elemId) {
  28. var style = window.getComputedStyle(document.getElementById(elemId));
  29. ok(style.width.match(/^\d+px$/),
  30. "Inline Outer SVG element's getComputedStyle.width should be used value. ");
  31. ok(style.height.match(/^\d+px$/),
  32. "Inline Outer SVG element's getComputedStyle.height should be used value.");
  33. });
  34. shouldUseComputed.forEach(function(elemId) {
  35. var style = window.getComputedStyle(document.getElementById(elemId));
  36. // Computed value should match either the percentage used, or "auto" in the case of the inner SVG element.
  37. ok(style.width.match(/^\d+%$|^auto$/),
  38. "Inline inner SVG element's getComputedStyle.width should be computed value. " + style.width);
  39. ok(style.height.match(/^\d+%$|^auto$/),
  40. "Inline inner SVG element's getComputedStyle.height should be computed value. " + style.height);
  41. });
  42. </script>
  43. </pre>
  44. </body>
  45. </html>