Justin,
there's no need to explicitly return a "rule" in this case.
#detect(#find) does it automatically:

$A(document.styleSheets[0].cssRules).detect( function(rule) {
  return rule.selectorText == 'a:hover';
});

- kangax


On May 31, 1:02 pm, "Justin Perkins" <[EMAIL PROTECTED]> wrote:
> You can access the stylesheets via document.styleSheets, and you can
> even manipulate through these means as well. It gets extremely clunky
> very fast, but it is possible. Here is an example:
>
> var hoverRule =
> $A(document.styleSheets[0].cssRules).detect(function(rule){if
> (rule.selectorText == 'a:hover') return rule;});
> hoverRule.style.color = '#0C0'; // make the hover state for all links green;
>
> If you're just sticking to anchor pseudo classes like :hover, :active,
> etc... then this could be the approach you're looking for, but if
> you're looking to update arbitrary selectors things will get pretty
> unwieldy for you quite fast.
>
> -justin
--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-spinoffs@googlegroups.com
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