Binding "change" on an select though .live() doesn't seem to work in IE using jQuery 1.4

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Binding "change" on an select though .live() doesn't seem to work in IE using jQuery 1.4

mape
The example works fine in Firefox 3.6, Safari 4.0.4 and Chrome
4.0.295.0 dev.

Doesn't seem to work in IE8 (native) and IE6, IE7 (though IEtester).

http://mape.me/jquery/select-live-ie/

--
You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.


Reply | Threaded
Open this post in threaded view
|

Re: Binding "change" on an select though .live() doesn't seem to work in IE using jQuery 1.4

alexander farkas
I have looked into this. The "trigger-line" in the testChange-function
has to be changed from this:

return jQuery.event.trigger( e, arguments[1], this );

to this:

return jQuery.event.trigger( e, arguments[1], elem );

Additional It seems, that there was a typo. The condition above
contains the following statement:

elem.type !== "select"

wich is always true. I think this can be deleted, without problems.

On 16 Jan., 14:34, mape <[hidden email]> wrote:
> The example works fine in Firefox 3.6, Safari 4.0.4 and Chrome
> 4.0.295.0 dev.
>
> Doesn't seem to work in IE8 (native) and IE6, IE7 (though IEtester).
>
> http://mape.me/jquery/select-live-ie/

--
You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.


Reply | Threaded
Open this post in threaded view
|

Re: Binding "change" on an select though .live() doesn't seem to work in IE using jQuery 1.4

Mattias Hallström
In reply to this post by mape
We have the same problem, but found out that it works if we chain bind
and live like this:

this.bind("change", function(e){
                // Do nothing
        }).live("change", function(e){
});

Not sure why though?!

//Mattias
On 16 Jan, 14:34, mape <[hidden email]> wrote:
> The example works fine in Firefox 3.6, Safari 4.0.4 and Chrome
> 4.0.295.0 dev.
>
> Doesn't seem to work in IE8 (native) and IE6, IE7 (though IEtester).
>
> http://mape.me/jquery/select-live-ie/

--
You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.


Reply | Threaded
Open this post in threaded view
|

Re: Binding "change" on an select though .live() doesn't seem to work in IE using jQuery 1.4

Mattias Hallström
My misstake. It "almost works.
If we run this on a page where content doesn't come via ajax, it
doesn't work!

Also it's not enough just to run this.live() on "none ajax content"
either, but when we chain bind and live it works.

//Mattias

On 18 Jan, 11:51, Mattias Hallström <[hidden email]> wrote:

> We have the same problem, but found out that it works if we chain bind
> and live like this:
>
> this.bind("change", function(e){
>                 // Do nothing
>         }).live("change", function(e){
>
> });
>
> Not sure why though?!
>
> //Mattias
> On 16 Jan, 14:34, mape <[hidden email]> wrote:
>
>
>
> > The example works fine in Firefox 3.6, Safari 4.0.4 and Chrome
> > 4.0.295.0 dev.
>
> > Doesn't seem to work in IE8 (native) and IE6, IE7 (though IEtester).
>
> >http://mape.me/jquery/select-live-ie/

--
You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.


Reply | Threaded
Open this post in threaded view
|

Re: Binding "change" on an select though .live() doesn't seem to work in IE using jQuery 1.4

Matias-17
Added TRAC ticket: http://dev.jquery.com/ticket/5851

--
You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.


Reply | Threaded
Open this post in threaded view
|

Re: Binding "change" on an select though .live() doesn't seem to work in IE using jQuery 1.4

alexander farkas
In reply to this post by Mattias Hallström
The bug happens due to the fact, that jQuery "cleans up the event in
case it is reused" in his trigger method (e.target = elem). If a
change is detected the current implementation calls trigger with the
element as the elem-argument for trigger. (with live: in most cases
the document/with bind: in most cases the select-element itself)

This means that the change-event is actually triggered on the
document, but e.target references also the document-object, so that
the closest-method can´t find a matching element and won´t call your
event-handler.

This also explains why the strange behavior occurs if you additionally
bind a change event directly to the select-element. The change is
detected and the trigger function is invoked with the select-element
as the elem-argument, so that it can be handled properly by live,
too.

Additionally it explains, why this bug could pass the testsuite.
change is testet here with both bind and live in one page at one time.
This is really annoying, but it´s extremly hard to build a good
testcase for the change-event and noone thought about such an
interference.

The code explained above will fix this issue.

On 18 Jan., 11:51, Mattias Hallström <[hidden email]> wrote:

> We have the same problem, but found out that it works if we chain bind
> and live like this:
>
> this.bind("change", function(e){
>                 // Do nothing
>         }).live("change", function(e){
>
> });
>
> Not sure why though?!
>
> //Mattias
> On 16 Jan, 14:34, mape <[hidden email]> wrote:
>
> > The example works fine in Firefox 3.6, Safari 4.0.4 and Chrome
> > 4.0.295.0 dev.
>
> > Doesn't seem to work in IE8 (native) and IE6, IE7 (though IEtester).
>
> >http://mape.me/jquery/select-live-ie/

--
You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.


Reply | Threaded
Open this post in threaded view
|

Re: Binding "change" on an select though .live() doesn't seem to work in IE using jQuery 1.4

Matias-17
On Jan 18, 11:42 pm, alexander farkas <[hidden email]>
wrote:
> The code explained above will fix this issue.

Great, and John has now committed the fix. Let's hope 1.4.1 is not too
far away! ;)

--
You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.


Reply | Threaded
Open this post in threaded view
|

Re: Re: Binding "change" on an select though .live() doesn't seem to work in IE using jQuery 1.4

John Resig
Administrator
> Great, and John has now committed the fix. Let's hope 1.4.1 is not too
> far away! ;)

It'll be out by Friday.

--John

--
You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.


Reply | Threaded
Open this post in threaded view
|

Re: Binding "change" on an select though .live() doesn't seem to work in IE using jQuery 1.4

Mattias Hallström
In reply to this post by Matias-17
Great news :-)

Thanks for the fix!

On 19 Jan, 11:52, matiasnu <[hidden email]> wrote:
> On Jan 18, 11:42 pm, alexander farkas <[hidden email]>
> wrote:
>
> > The code explained above will fix this issue.
>
> Great, and John has now committed the fix. Let's hope 1.4.1 is not too
> far away! ;)

--
You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.

Reply | Threaded
Open this post in threaded view
|

Re: Binding "change" on an select though .live() doesn't seem to work in IE using jQuery 1.4

Elias-30
Is the fix released? If so, where can I get it from?

--
You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.

Reply | Threaded
Open this post in threaded view
|

Re: Re: Binding "change" on an select though .live() doesn't seem to work in IE using jQuery 1.4

John Resig
Administrator
1.4.1 will be out today, you can get the fix at that time.

--John



On Mon, Jan 25, 2010 at 1:28 PM, Elias <[hidden email]> wrote:
> Is the fix released? If so, where can I get it from?
>
> --
> You received this message because you are subscribed to the Google Groups "jQuery Development" group.
> To post to this group, send email to [hidden email].
> To unsubscribe from this group, send email to [hidden email].
> For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.
>
>

--
You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.