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