From: Jorge on 28 Mar 2010 16:51 On Mar 28, 9:50 pm, "Michael Haufe (\"TNO\")" <t...(a)thenewobjective.com> wrote: > On Mar 28, 1:56 pm, Hans-Georg Michna <hans- > > georgNoEmailPle...(a)michna.com> wrote: > > That leaves the question, why are the browser makers > > implementing something that nobody should use? (:-) > > QSA was implemented in browsers because it was a common pattern found > in today's libraries, and in the competitive browser world you don't > want to be the only one without parity functionality. Now whether its > fundamentally the right thing to do is another question that isn't > simple to answer. Personally I dislike having 2 or more embedded DSLs > in the browser, but the "better" alternative is not an easy goal to > obtain IMO. While an element can have just one id and it must be unique, it can have nearly as many different and non-unique classes as you want, and that allows you to attach multiple different labels to the elements based on different criterias. Then QSA allows for finding them afterwards. It's a Good Thing, IMO. And when implemented natively, it's also FAST. And, its use often hasn't anything to do with CSS or styles (a CSS style rule for those classes doesn't even need to exist). It's just a - convenient- means to classify/search/retrieve groups of elements. -- Jorge.
From: David Mark on 28 Mar 2010 17:09 Jorge wrote: > On Mar 28, 9:50 pm, "Michael Haufe (\"TNO\")" > <t...(a)thenewobjective.com> wrote: >> On Mar 28, 1:56 pm, Hans-Georg Michna <hans- >> >> georgNoEmailPle...(a)michna.com> wrote: >>> That leaves the question, why are the browser makers >>> implementing something that nobody should use? (:-) >> QSA was implemented in browsers because it was a common pattern found >> in today's libraries, and in the competitive browser world you don't >> want to be the only one without parity functionality. Now whether its >> fundamentally the right thing to do is another question that isn't >> simple to answer. Personally I dislike having 2 or more embedded DSLs >> in the browser, but the "better" alternative is not an easy goal to >> obtain IMO. > > While an element can have just one id and it must be unique, it can > have nearly as many different and non-unique classes as you want, and > that allows you to attach multiple different labels to the elements > based on different criterias. And...? > Then QSA allows for finding them > afterwards. So does a six line DOM traversal, not to mention gEBCN. ;) > It's a Good Thing, IMO. It's not a good thing. It's perhaps the worst thing to ever hit browsers. The original idea may have seemed good at the time, but the implementations were so bad as to render it a complete boondoggle. Giving the same people a faster, but slightly incompatible host implementation was a huge mistake (as evidenced by the subsequent pouncing and disingenuous crowing that followed). > And when implemented natively, > it's also FAST. It's a fast way to get an unexpected answer (particularly if you have been indoctrinated into the various query-based libraries). I'd rather get consistent results a bit slower. Furthermore, as recently noted, the browsers that feature QSA are not going to be particularly slow to fetch elements by class name (unless you are dealing with a huge and complex DOM structure, in which case you should think about changing _that_ rather than swapping one poison for another). > > And, its use often hasn't anything to do with CSS or styles (a CSS > style rule for those classes doesn't even need to exist). Using class names for something other than intended indicates a bad design.
From: Eric Bednarz on 28 Mar 2010 17:44 David Mark <dmark.cinsoft(a)gmail.com> writes: > Using class names for something other than intended indicates a bad design. Class names have a general purpose role in HTML; I find it pretty hard to think of a use case that isn't covered by that.
From: "Michael Haufe ("TNO")" on 28 Mar 2010 19:08 On Mar 28, 4:44 pm, Eric Bednarz <bedn...(a)fahr-zur-hoelle.org> wrote: > David Mark <dmark.cins...(a)gmail.com> writes: > > Using class names for something other than intended indicates a bad design. > > Class names have a general purpose role in HTML; I find it pretty hard > to think of a use case that isnt covered by that. People are using class names for things they weren't meant to be used for. Ironically people are trying to shoehorn semantic meaning into HTML where it was already available in XHTML (go figure)
From: Garrett Smith on 28 Mar 2010 22:16
Michael Haufe ("TNO") wrote: > On Mar 28, 4:44 pm, Eric Bednarz <bedn...(a)fahr-zur-hoelle.org> wrote: >> David Mark <dmark.cins...(a)gmail.com> writes: >>> Using class names for something other than intended indicates a bad design. >> Class names have a general purpose role in HTML; I find it pretty hard >> to think of a use case that isn�t covered by that. > > People are using class names for things they weren't meant to be used > for. Ironically people are trying to shoehorn semantic meaning into > HTML where it was already available in XHTML (go figure) 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? -- Garrett comp.lang.javascript FAQ: http://jibbering.com/faq/ |