Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: third_party/WebKit/LayoutTests/svg/custom/disallow-non-lengths-in-attrs.html

Issue 1901673003: Improve default value handling for SVGSVGElement.width/height (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move to parseAttribute Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <!-- Simple test for 2 <!-- Simple test for
3 3
4 https://svgwg.org/svg2-draft/styling.html#WidthProperty 4 https://svgwg.org/svg2-draft/styling.html#WidthProperty
5 https://svgwg.org/svg2-draft/styling.html#HeightProperty 5 https://svgwg.org/svg2-draft/styling.html#HeightProperty
6 6
7 "For backwards compatibility, when the 'width' or 'height' 7 "For backwards compatibility, when the 'width' or 'height'
8 properties are specified as a presentation attributes, only the 8 properties are specified as a presentation attributes, only the
9 values that match the <length> production shall be mapped to 9 values that match the <length> production shall be mapped to
10 CSS. Any other value must be treated as invalid." --> 10 CSS. Any other value must be treated as invalid." -->
(...skipping 10 matching lines...) Expand all
21 function setWidth(selector, width) { 21 function setWidth(selector, width) {
22 try { document.querySelector(selector).setAttribute('width', width); } c atch (err) {} 22 try { document.querySelector(selector).setAttribute('width', width); } c atch (err) {}
23 } 23 }
24 function getWidth(selector) { 24 function getWidth(selector) {
25 return document.querySelector(selector).getBoundingClientRect().width; 25 return document.querySelector(selector).getBoundingClientRect().width;
26 } 26 }
27 var invalid_widths = [ 'auto', 'initial', 'inherit', 'foo' ]; 27 var invalid_widths = [ 'auto', 'initial', 'inherit', 'foo' ];
28 invalid_widths.forEach(function(invalid_width) { 28 invalid_widths.forEach(function(invalid_width) {
29 setWidth('#svg', invalid_width); 29 setWidth('#svg', invalid_width);
30 test(function() { 30 test(function() {
31 assert_equals(getWidth('#svg'), 0); 31 assert_equals(getWidth('#svg'), document.body.clientWidth);
32 }, "Test width '" + invalid_width + "' on SVGSVGElement"); 32 }, "Test width '" + invalid_width + "' on SVGSVGElement");
33 33
34 setWidth('#fO', invalid_width); 34 setWidth('#fO', invalid_width);
35 test(function() { 35 test(function() {
36 assert_equals(getWidth('#fO'), 0); 36 assert_equals(getWidth('#fO'), 0);
37 }, "Test width '" + invalid_width + "' on SVGForeignObject"); 37 }, "Test width '" + invalid_width + "' on SVGForeignObject");
38 }); 38 });
39 </script> 39 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698