- From: Aryeh Gregor <ayg@aryeh.name>
- Date: Tue, 21 Feb 2012 09:35:11 -0500
- To: css21testsuite@gtalbot.org
- Cc: CSS-testsuite <public-css-testsuite@w3.org>
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/transform-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/ref-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.
Received on Tuesday, 21 February 2012 14:36:05 UTC