W3C home > Mailing lists > Public > www-style@w3.org > September 2010

Re: [cssom] Directions for better OM expansions

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Fri, 17 Sep 2010 16:45:33 -0700
Message-ID: <AANLkTi=VpxrsVatonoaYPQB01WB97eeWidiBDOUKckUm@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Maciej Stachowiak <mjs@apple.com>, Anne van Kesteren <annevk@opera.com>, www-style list <www-style@w3.org>
On 9/17/10, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
> On Fri, Sep 17, 2010 at 11:44 AM, Maciej Stachowiak <mjs@apple.com> wrote:
[...]

>>> 6. I'm a page author, and I want to read/write the value of a property
>>> in the style-sheet block that's providing the value (or just the first
>>> one that *would* provide the value, if it wasn't being overridden by
>>> @style or something) so that the change will propagate to all similar
>>> elements.  (Possibly this requires a bit more smarts from the author,
>>> like examining selectors?)
>>
>> Is there a real scenario where page authors would use this? I am mildly
>> skeptical, based on the vague story.
>
> 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.

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.

>
>> 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.

Garrett
Received on Friday, 17 September 2010 23:46:07 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:31 GMT