On 18 February 2011 13:13, Loic Giraudel <[email protected]> wrote:
> A thread about this behavior in StackOverflow
> : http://stackoverflow.com/questions/1694595/can-i-call-jquery-click-to-follow-an-a-link-if-i-havent-bound-an-event-handl
Ah, yes, that's interesting. So jquery's click() doesn't simulate a
user mouse click event. Rather, it triggers all event handlers
registered to that element. The ones which were working did have, as
Mark pointed out, event handlers attached to them.
Normally there'd be no reason to simulate a click event in this way
and I can sort of see why jQuery might prevent it as a security
measure. However, I've been building some functional tests (using Geb)
where this behaviour is exactly what we want.
To get around it, I've added the following to run on every page of the site:
jQuery('a').click(function(){document.location.href=this.href});
I don't like this very much - it feels a little dangerous for reasons
I can't put my finger on.
Cheers,
Tom
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]