- From: Alan Stearns <stearns@adobe.com>
- Date: Tue, 21 Feb 2012 06:49:49 -0800
- To: Aryeh Gregor <ayg@aryeh.name>, "css21testsuite@gtalbot.org" <css21testsuite@gtalbot.org>
- CC: CSS-testsuite <public-css-testsuite@w3.org>
On 2/21/12 6:35 AM, "Aryeh Gregor" <ayg@aryeh.name> wrote: > 2012/2/20 "Gérard Talbot" <css21testsuite@gtalbot.org>: >> CSS was designed to reuse code, to reduce code and to help create a >> clear separation of structure and presentation. With inline style, you >> have none of these. By adopting such guideline, the test suite is >> promoting best coding practices for CSS. > > In cases where you know that the style will only ever be used once, I > don't see how these considerations are relevant. Inline style exists > for a reason -- it's shorter and clearer to write > <div style="foo"> > than > <div id="abc"><style>#abc { foo }</style> > This is in fact why inline style exists. > > I'm not sure how the test suite's markup promotes any coding practices > for CSS, since almost nobody is going to look at the source code for > the tests. But I would say to the contrary that if the tests use > <style> where inline style would be more succinct, they're promoting > *bad* coding practice. Good coding practice is to place style inline > or out-of-band depending on which results in clearer and shorter > markup, not to always use out-of-band style no matter what. > >> We can not see the test you are referring to. > > http://hg.mozilla.org/mozilla-central/file/4038ffaa5d82/layout/reftests/transf > orm-3d/sorting-1a.html > > Notice how #big is before #small, but <div id=small> is before <div > id=big>. Also notice how even if that weren't true, you'd have to > first look down at the bottom of the file to figure out where the four > divs are, then look back up to the style keeping that in mind. > (#stage is parent of #parent, #parent is parent of #big and #small.) > > My rewritten version: > > http://hg.csswg.org/test/file/5d82a43286ea/contributors/aryehgregor/incoming/r > ef-3d/sorting-1a.html > > Notice that it's ten lines instead of 35, and can be read sequentially > without having to remember anything. > > This is just a motivating example, of course. Whether there's one or > a thousand is not the point -- it's the underlying issues that matter, > and the example only illustrates those issues. While I agree with you that the order of big and small should be consistent in that particular test, I very much disagree that the compact inline form of this test is clearer. Inline styles that set a single property are usually fine, but once you have a second property (or more) inline I find it much harder to scan. I strongly prefer one property per line in a style block when there's more than one property to read. I find this particular case a motivating example for a separating style from markup. Thanks, Alan
Received on Tuesday, 21 February 2012 14:50:26 UTC