-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Christophe Porteneuve wrote:
> jdalton a écrit :
>> I am trying to do something like $$('a:contains("next >")'); but I get
>> a js error when executing that.
> I'd really like you to tell me what exactly you think this selector
> should fetch... It's not a CSS3 selector at all (:contains does not seem
> to be part of the CSS 3 Selectors spec).
>
> At "worst," and assuming I guess your intent correctly, you can emulate
> it like so (untested, but should do well enough):
>
> $$('a').select(function(link) { return
> link.innerHTML.stripTags().include('next >'); })
AFAICT, this shouldn't really work because innerHTML doesn't decode HTML
entities (">" in this example), but anyway, the approach sounds OK.
OTOH, XPath should do it with: $x('.//a[contains(.,"next >")]')
In Prototype terms, this would become:
document._getElementsByXPath('.//a[contains(.,"next >")]')
But anyway this was just for the sake of example, as, AFAIK, currently
Prototype doesn't have XPath support for "some" browsers (e.g. MSIE).
> 'HTH
+1 ;-)
- --
Marius Feraru
-----BEGIN PGP SIGNATURE-----
iD8DBQFGPIu5tZHp/AYZiNkRAuBqAJsHHOfKqsGjVubAMKg/hbUKp9NbRQCfWLLe
pd38GEgm1sfjgvtAWg4m6zo=
=gYMo
-----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 [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
-~----------~----~----~----~------~----~------~--~---