From: "Michael Haufe ("TNO")" on 29 Mar 2010 11:01 On Mar 29, 9:33 am, Hans-Georg Michna <hans- georgNoEmailPle...(a)michna.com> wrote: > I'm not so sure about that. Sometimes you just need some element > grouping, and that is, generally speaking, what the class > attribute is for. I believe a different attribute should have been used for that purpose. In SVG, the <g/> tag is used for example. In MXML there is a groupName attribute (for some elements at least). > Whether you then give that group a style or a JavaScript > treatment shouldn't matter too much, I think. It is certainly > well within the standards to give some elements class > attributes, whether they are used in CSS or not. Just because its a standard doesn't make it ok.
From: David Mark on 29 Mar 2010 13:36 Michael Haufe ("TNO") wrote: > On Mar 29, 9:33 am, Hans-Georg Michna <hans- > georgNoEmailPle...(a)michna.com> wrote: > >> I'm not so sure about that. Sometimes you just need some element >> grouping, and that is, generally speaking, what the class >> attribute is for. > > I believe a different attribute should have been used for that > purpose. In SVG, the <g/> tag is used for example. In MXML there is a > groupName attribute (for some elements at least). > >> Whether you then give that group a style or a JavaScript >> treatment shouldn't matter too much, I think. It is certainly >> well within the standards to give some elements class >> attributes, whether they are used in CSS or not. > > Just because its a standard doesn't make it ok. Ain't that the truth! :)
From: Garrett Smith on 29 Mar 2010 14:45 Michael Haufe ("TNO") wrote: > On Mar 28, 9:16 pm, Garrett Smith <dhtmlkitc...(a)gmail.com> wrote: > >> The HTML class attribute is not meant to be limited for any particular >> task. What is`class` being used for that it was not meant for? > > I think that's the problem with it. Without a clear definition of > purpose, it becomes meaningless. While it's usually used as a hook for > CSS, it's also used for meta data which is a questionable thing IMO, > also I've seen it used as a data storage location. If I have the > following: > > <div class="foo bar baz quux"></div> The problem with that example does not use semantic class names. Meaningless class names can make the code totally confusing. > > That information has no meaning. You're forced to evaluate stylesheets > and some perceived data model to figure out the purpose. I don't see > this as a good thing. Class values that have no semantic meaning often force to reader to read through the stylesheets to try and figure out what the code is doing. A use of semantic class name could be: <span class="email">me(a)example.com</span> HTML doesn't provide an EMAIL element. It does provide generic element and it does provide a way to make that element belong to a class. Taking semantic class to the next level would be formalization of specific class names, such as how to represent email address. That's basically what microformats does. Microformats makes it possible to, say, write a function `hCardToJSON(div)`, and have that take a div and create and return an object that has the vcard properties. -- Garrett comp.lang.javascript FAQ: http://jibbering.com/faq/
From: Hamish Campbell on 29 Mar 2010 17:02 On Mar 30, 3:33 am, "Michael Haufe (\"TNO\")" <t...(a)thenewobjective.com> wrote: > I think that's the problem with it. Without a clear definition of > purpose, it becomes meaningless. While it's usually used as a hook for > CSS, it's also used for meta data which is a questionable thing IMO, > also I've seen it used as a data storage location. If I have the > following: > > <div class="foo bar baz quux"></div> > > That information has no meaning. You're forced to evaluate stylesheets > and some perceived data model to figure out the purpose. I don't see > this as a good thing. Eh? It's not meta-data - it's an arbitrary grouping reference that means whatever you need it to mean. That *is* its purpose. Presumably you wrote the HTML, so complaining that you can't then determine the datamodel (?) by evaluating the stylesheet (?) is a straw man argument.
From: Thomas 'PointedEars' Lahn on 29 Mar 2010 17:08
Garrett Smith wrote: > Not only does HTML 4 explicitly allow class to be used for reasons other > than CSS, it is actually used for such ulterior purposes. Microformats, > for example, utilize class attribute in HTML. Microformats are not based on semantic markup; they are a design mistake. PointedEars -- realism: HTML 4.01 Strict evangelism: XHTML 1.0 Strict madness: XHTML 1.1 as application/xhtml+xml -- Bjoern Hoehrmann |