-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Daniel Eben Elmore wrote:
Is there a function like getElementsByClassName where I can use regex to match the class names?
There's no such sugar currently implemented in Prototype, but, as Aaron showed you already, it's quite easy to implement. Allegedly, a more efficient solution would be to use XPath, for which we have "document._getElementsByXPath" (example below). There is one "tiny" problem though (hence the underscore): this method is available only for browsers that support "document.evaluate" method. You'll have to bake your own method for the "others" and submit a patch :) AFAIK Internet Explorer has an ActiveX object supporting XPath - Msxml.DOMDocument - but that's all I heard ;-)
I want to match class names starting with ...
document._getElementsByXPath('.//*[contains(concat(" ", @class), " foo")]') ^ this would return a list of elements that have class names starting with "foo". cheers - -- Marius Feraru -----BEGIN PGP SIGNATURE----- iD8DBQFFsJpdtZHp/AYZiNkRAlZ4AJ44xW5SR4vEDXqpesymPkHHfpR8AACeOYRC JpAltoOeWWbA6R6NGDsmUBU= =Qk31 -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---