You can use $$('any css3 selector here') as a shortcut to
getElementsBySelector (and you get automatically extended elements
when you do). To read a list of the classes currently applied to each
element you find, you could do this:
$$('div.foo').each(function(elm){ console.log( elm.className ); });
If you want to get the classes as an array that you could iterate
over, then just run the $w() function against the className to turn
the whitespace-delimited list into a proper array.
Walter
On Feb 8, 2010, at 12:09 AM, webber wrote:
hey all,
Im new to prototype and was wondering if there's anyway i could know
which css rules are being applied for an element.
I know getElementsBySelector will give all nodes by the rule but i
need it to work the other way around i.e. given an element get the
active css rules.
Thanks
--
You received this message because you are subscribed to the Google
Groups "Prototype & script.aculo.us" 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/prototype-scriptaculous?hl=en
.
--
You received this message because you are subscribed to the Google Groups "Prototype
& script.aculo.us" 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/prototype-scriptaculous?hl=en.