Option for event stopping event propagation in jq_remote_function

57 views
Skip to first unread message

flocki

unread,
Dec 21, 2010, 6:40:22 AM12/21/10
to sfJqueryReloadedPlugin
I've had problems with event bubbling [1] Using a link generated by
"jq_link_to_remote". It seems that returning false does not prevent
the event from bubbling [2] if it is assigned via html (i'm using
jquery 1.4.2).

So I have extended the "jq_remote_function" function to adhere to an
additional "'stop_propagation" parameter:

function jq_remote_function($options)
{
...
return $function.(isset($options['stop_propagation']) ? ';
event.stopPropagation();' : '');
}



[1] http://www.quirksmode.org/js/events_order.html
[2] http://api.jquery.com/bind/

Tom Boutell

unread,
Dec 21, 2010, 8:40:07 AM12/21/10
to sfjqueryrel...@googlegroups.com
This probably isn't too drastic a change, does it work across browsers though?

--
Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com

flocki

unread,
Dec 21, 2010, 9:51:57 AM12/21/10
to sfJqueryReloadedPlugin
Update:

return $function.(isset($options['stop_propagation']) ? '; if(event &&
event.stopPropagation) {event.stopPropagation();} else
{window.event.cancelBubble = true;}' : '');

This now works on firefox, chrome, ie(8) and safari.

Tom Boutell

unread,
Dec 21, 2010, 10:08:32 AM12/21/10
to sfjqueryrel...@googlegroups.com
Are you a dev on the plugin yet? If not request to be via the Symfony
site so I can approve it and you can submit a patch via svn

rigoberto reyes

unread,
Dec 21, 2010, 12:28:01 PM12/21/10
to sfjqueryrel...@googlegroups.com

Enviado desde un androide

Tom Boutell <t...@punkave.com> escribió:

>This probably isn't too drastic a change, does it work across browsers though?
>

flocki

unread,
Dec 22, 2010, 7:22:57 AM12/22/10
to sfJqueryReloadedPlugin
I have just commited this and an additional patch that adds an option
to control caching.

On 21 Dez., 18:28, rigoberto reyes <rigre...@gmail.com> wrote:
> Enviado desde un androide
>
> Tom Boutell <t...@punkave.com> escribió:
>
> >This probably isn't too drastic a change, does it work across browsers though?
>
Reply all
Reply to author
Forward
0 new messages