- From: Gérard Talbot <css21testsuite@gtalbot.org>
- Date: Tue, 21 Feb 2012 14:33:22 -0500
- To: "Aryeh Gregor" <ayg@aryeh.name>
- Cc: "CSS-testsuite" <public-css-testsuite@w3.org>
Le Mar 21 février 2012 9:35, Aryeh Gregor a écrit : > 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 Aryeh, I believe it's not the reason why inline style exists. Inline style may be shorter (involving less declarative protocols) but the overall picture of source code will definitely not be clearer: such distortion/imbalance will grow as source code is longer, bigger. > <div style="foo"> > than > <div id="abc"><style>#abc { foo }</style> A bunch of tests in the test suite set an id on one single div being tested but since there is only 1 div in the whole test, then declaring and setting the attribute id is not needed. So, in such cases, the CSS code could be made more compact without compromising the "self-meaningfulness" of the test. > 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. For sure, the test suite should welcome and invite people (web authors, website tutorial writers, book authors, etc.) to read, examine, learn from the source code. Ultimately, all this work is for web authors (serving their website visitors). Not browser manufacturers. > 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>. "stage", "parent", "big" and "small" are at least descriptive of something, meaningful inside the design logic of the test, trying to be helpful with regards to the working logic of the testcase, descriptive of the design logic of the testcase. That is what I first noticed in the test. " It's helpful to people trying to understand the test if you use meaningful class and ID names " http://wiki.csswg.org/test/css2.1/format#body-content #stage and #parent rules could have been declared on 1 line each instead of 3. What's easier for coders, reviewers, maintenance: to remember that #995C7F is a purple-ish color or to use/read/write "purple" ? You can't tell me that one is shorter than the other here.. > 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.) Like I said, there is no guideline on this in the http://wiki.csswg.org/test/css2.1/format wiki page; personally, in all my tests and all my webpages, I try to make the CSS code order follow the tree of nodes in HTML. Because it is helpful (site maintenance, review by others, avoid mix up, etc) > > 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. There are issues too with this style of code. The source code of your rewritten version has no indentation; your version is not necessarly easier to examine, to figure out. I like empty lines to better separate sections, rules (it's called active white space). I have seen huge javascript files which had several Kbytes of code and had only 1 line! > 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. Aryeh, you do not intend to comply with the current format guidelines, do you? You only want to comply with the format guidelines that suit you, that you feel are adequate to you, to your coding style. Gérard -- Contributions to the CSS 2.1 test suite: http://www.gtalbot.org/BrowserBugsSection/css21testsuite/ CSS 2.1 Test suite RC6, March 23rd 2011: http://test.csswg.org/suites/css2.1/20110323/html4/toc.html CSS 2.1 test suite harness: http://test.csswg.org/harness/ Contributing to to CSS 2.1 test suite: http://www.gtalbot.org/BrowserBugsSection/css21testsuite/web-authors-contributions-css21-testsuite.html
Received on Tuesday, 21 February 2012 19:33:57 UTC