On Jun 15, 6:10 pm, Christophe Porteneuve <[EMAIL PROTECTED]> wrote:
> Hey Daniel,
>
> Daniel Eben Elmore a écrit :
>
> > Is there a way to edit a CSS rule instead of having to edit all the elements
> > that contain the rule?
>
> > So if I had a CSS class: "title" can I change title's font-size dynamically
> > without doing something like a getElementsByClassName loop?
>
> DOM Level 2 CSS lets you do just that, but I believe it has pretty
> scarce support so far...
I wouldn't say that, CSS 2 support isn't really the issue. Modifying
stylesheets is a bit of a chore but it's well supported (at least by
browsers that Prototype.js supports) and once you have a function to
do it... :-)
The link below shows a specific example, the general idea is to sift
through the style sheets looking for the appropriate rule, then modify
it. It's easy if you're looking for a class or ID, tougher for pseudo-
classes and other rule types.
<URL:
http://groups.google.com.au/group/comp.lang.javascript/browse_frm/thread/ac3617de7840cdc5/737a6ebc3674a373?lnk=gst&q=stylesheets&rnum=1&hl=en#737a6ebc3674a373
>
Another example:
<URL:
http://groups.google.com.au/group/comp.lang.javascript/browse_frm/thread/8099b8785bbbc188/3713059f8aa18f97?lnk=gst&q=stylesheets&rnum=9&hl=en#3713059f8aa18f97
>
If you have lots of individual elements to hide (say a column in a
table) it is much, much faster to modify a class rule that they all
share than loop over all the rows and hide cells[x] one by one.
--
Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---