- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Fri, 17 Sep 2010 17:08:25 -0700
- To: Garrett Smith <dhtmlkitchen@gmail.com>
- Cc: Maciej Stachowiak <mjs@apple.com>, Anne van Kesteren <annevk@opera.com>, www-style list <www-style@w3.org>
On Fri, Sep 17, 2010 at 4:45 PM, Garrett Smith <dhtmlkitchen@gmail.com> wrote: > On 9/17/10, Tab Atkins Jr. <jackalmage@gmail.com> wrote: >> Oh man, yes. It's quite common, actually. I've written a lot of >> jQuery code where I explicitly grab a group of related elements by >> selector and twiddle their @style (this is trivial in jQuery, since >> the .css() function doesn't care whether it's being applied to a >> single element or a collection). Being able to do this on the >> stylesheet level where it belongs so I don't end up accidentally >> clobbering existing @style values would be nice. >> > > More than one way to skin a cat. That particular strategy is a > well-known antipattern at this point. Incredible that jQuery is still > being used at this point for anything, though I see jQuery users > employing that pattern a lot. Different strokes, I guess. (Though jQuery is still the single most popular js library, I believe.) > Much simpler to add a class token to a common ancestor and let the > cascade take place. Example linked from the c.l.js FAQ code guidelines > doc. That doesn't address the case I care about, where you're changing a style dynamically. Your approach is doable for swapping between sets of predefined styles, but it's useless for when you don't know the desired styles beforehand. >>> In fact, most of these page author use >>> cases are pretty vague. It would help to get more concrete, for instance >>> "I >>> want to animate the size and bounds of a lightbox when it initially >>> appears" > > What's a lightbox? I'm fearing it means that awful jQuery plugin > script. Please tell me I'm paranoid. A lightbox is a common UI element at this point, where you take some element and pop it up in a pseudo-window (really just an element with distinctive styling). You usually dim out the rest of the page around the lightbox as well. ~TJ
Received on Saturday, 18 September 2010 00:09:18 UTC