- From: L. David Baron <dbaron@dbaron.org>
- Date: Wed, 2 Jan 2013 15:47:26 -0500
- To: whatwg@whatwg.org
http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#tables says: # The table element's width attribute maps to the dimension # property 'width' on the table element. ... # The td and th elements' width attributes map to the dimension # property 'width' on the element. These rules should have an extra condition to say that any zero value (be it a zero integer or a zero percentage) is ignored rather than mapping to the 'width' property. This is needed for Web-compatibility; width="0" is ignored by all major browser engines (at least for the td case, which I tested), and source-code comments in Gecko indicate this behavior is needed for compatibility. However, they're ignored at different levels in different engines. In Gecko and IE10, they're ignored at the level that I'm proposing, and 'width:0' in CSS still works. In WebKit and Opera, 'width:0' in CSS is *also* ignored, presumably at the table layout level. Given the engine split here, I believe it's better to have the weird behavior be more limited, and I'd prefer to see the ignoring be specified at the HTML level so that CSS behaves without this discontinuity. My tests are as follows: http://dbaron.org/css/test/2013/cell-width-zero/cell-width-zero-standards-html http://dbaron.org/css/test/2013/cell-width-zero/cell-width-zero-quirks-html This pair of tests demonstrate that the HTML width="0" is ignored in all engines, and the first cell is slightly wider than the second. http://dbaron.org/css/test/2013/cell-width-zero/cell-width-one-standards-html http://dbaron.org/css/test/2013/cell-width-zero/cell-width-one-quirks-html This pair of tests demonstrate that HTML width="1" works in all engines, and forces the first cell to its minimum intrinsic width. http://dbaron.org/css/test/2013/cell-width-zero/cell-width-zero-standards-css http://dbaron.org/css/test/2013/cell-width-zero/cell-width-zero-quirks-css This pair of tests shows differing behaviors between browsers; the first cell is narrowed to its minimum intrinsic width in Gecko and IE10 (showing the behavior is at the HTML level) but not in WebKit or Opera (showing the behavior is at the CSS level). (It might be worth writing the parallel tests for <table> since I only tested <td>, and the parallel tests for percentage values since I only tested integer values.) -David -- 𝄞 L. David Baron http://dbaron.org/ 𝄂 𝄢 Mozilla http://www.mozilla.org/ 𝄂
Received on Wednesday, 2 January 2013 20:47:52 UTC