RobG wrote:
> 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.
Effect.morph() uses the snippet below to get css rules.  Getting and 
setting cssRules seems quite useful.  Are there any pitfalls to this 
approach?  Is it seen as an edge case?  I've seen no discussion from the 
library authors on cssRules. (see 
http://dev.rubyonrails.org/search?q=cssRules&wiki=on&changeset=on&ticket=on)

--Ken


effects.js version 1.7.1_beta3 line 939
---------------------------------------
var cssText = '', selector = '.' + options.style;
$A(document.styleSheets).reverse().each(function(styleSheet) {
  if (styleSheet.cssRules) cssRules = styleSheet.cssRules;
  else if (styleSheet.rules) cssRules = styleSheet.rules;
  $A(cssRules).reverse().each(function(rule) {
    if (selector == rule.selectorText) {
      cssText = rule.style.cssText;
      throw $break;
    }
  });
  if (cssText) throw $break;
});
this.style = cssText.parseStyle();


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

Reply via email to