Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!doctype html> | |
| 2 <!-- Simple test for | |
| 3 | |
| 4 https://svgwg.org/svg2-draft/styling.html#WidthProperty | |
| 5 https://svgwg.org/svg2-draft/styling.html#HeightProperty | |
| 6 | |
| 7 "For backwards compatibility, when the ‘width’ or ‘height’ | |
| 8 properties are specified as a presentation attributes, only the | |
| 9 values that match the <length> production shall be mapped to | |
| 10 CSS. Any other value must be treated as invalid." --> | |
| 11 <script src="../../resources/testharness.js"></script> | |
| 12 <script src="../../resources/testharnessreport.js"></script> | |
| 13 <span style="width:200px"> | |
| 14 <svg id="svg"></svg> | |
| 15 <svg width="400"> | |
| 16 <foreignobject id="fO"> | |
| 17 </foreignobject> | |
| 18 </svg> | |
| 19 </span> | |
| 20 <script> | |
| 21 function setWidth(selector, width) { | |
| 22 try { document.querySelector(selector).setAttribute('width', width); } c atch (err) {} | |
| 23 } | |
| 24 function getWidth(selector) { | |
| 25 return document.querySelector(selector).getBoundingClientRect().width; | |
| 26 } | |
| 27 var invalid_widths = [ 'auto', 'initial', 'inherit', 'foo' ]; | |
| 28 invalid_widths.forEach(function(invalid_width) { | |
| 29 setWidth('#svg', invalid_width); | |
| 30 test(function() { | |
| 31 assert_equals(getWidth('#svg'), 0); | |
| 32 }, "Test width '" + invalid_width + "' on SVGSVGElement"); | |
| 33 | |
| 34 setWidth('#fo', invalid_width); | |
|
pdr.
2014/05/05 16:53:11
This won't match #fO above.
davve
2014/05/06 07:05:19
Good eyes!
(I wish I could use querySelector('for
| |
| 35 test(function() { | |
| 36 assert_equals(getWidth('#fO'), 0); | |
| 37 }, "Test width '" + invalid_width + "' on SVGForeignObject"); | |
| 38 }); | |
| 39 </script> | |
| OLD | NEW |