Skip to main content

Bug Tracker

Side navigation

#11147 closed bug (invalid)

Opened January 09, 2012 09:56PM UTC

Closed January 11, 2012 12:49AM UTC

Last modified January 11, 2012 10:55PM UTC

1.7.1 altered event behavior for UI autocompleteselect event

Reported by: gvwalsh Owned by: gvwalsh
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:

Using JQuery 1.7.1 the behavior of the Jquery AutoComplete autocompleteselect event is different from 1.6.1. The "" is no longer the text box INPUT element associated with the plugin but is instead the dynamically created A element from the suggestion list. This results in the following example "delegate" no longer catching the event. Using JQuery 1.6.1 the event is in fact caught and is set to the INPUT element.

('body').delegate('input', 'autocompleteselect', function(event, ui) { blah blah blah);

However, even under JQuery 1.7.1 the code

$('input').bind('autocompleteselect', function(event, ui) { blah blah blah );

catches the event but the "" is the A element. However "event.currentTarget" is the INPUT element. I do not know enough about the DOM to understand the difference between and event.currentTarget.

This is at the very least a puzzling incompatibility which resulted in existing code stopping working and it smells like a bug. I suspect it is related to the new unified event handling of 1.7.1

Attachments (0)
Change History (9)

Changed January 09, 2012 10:36PM UTC by rwaldron comment:1

owner: → gvwalsh
status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket!

Additionally, be sure to test against the "jQuery (edge)" version to ensure the issue still exists. To get you started, use this boilerplate:

Open the link and click to "Fork" (in the top menu) to begin.

Changed January 11, 2012 12:17AM UTC by gvwalsh comment:2

status: pendingnew demonstrates new behavior against JQuery edge demonstrates the "working" behavior against JQuery 1.5.2

type "ab" into the text box and then select one of the suggestions. The version with 1.5.2 displays a "got here" alert indicating the event was caught. The latest version never gets to the alert. However the autocomplete does fill in the text box with the selected suggestion.

Changed January 11, 2012 12:49AM UTC by rwaldron comment:3

resolution: → invalid
status: newclosed

jQuery UI 1.8.9 was released in January 2011

jQuery 1.7 was released in November 2011

Safe to say that jQuery UI 1.8.9 isn't compatible with the latest jQuery

Changed January 11, 2012 01:51AM UTC by gvwalsh comment:4

The problem originally surfaced using JQuery UI 1.8.16 which, by my thinking should certainly be supported by the latest version of the JQuery core. I did not create a fiddle test case using this version of UI since the 1.8.9 version is the latest version that jsfiddle apparently offers for easy inclusion. The symptoms that appear in my full application using JQuery UI 1.8.16 appear identical to what happens with 1.8.9.

By the way the Yii framework distributes UI 1.8.16 with JQuery 1.7.1 which is where I originally encountered the problem - upgrading a working application to Yii 1.1.9 where it stopped working because of this autocomplete event problem.

Changed January 11, 2012 03:52AM UTC by rwaldron comment:5

jQuery 1.8.16 was released in August, 2011

Please file a ticket with Yii - they shouldn't be mixing and matching jQuery UI with incompatible versions of jQuery

Changed January 11, 2012 04:42AM UTC by gvwalsh comment:6

So what version of JQuery UI should be used with JQuery core 1.7.1? The current stable UI version is 1.8.17 which would be, by the customary way software versions are numbered, only a very minor difference away from 1.8.16. Are you saying that only UI version 1.8.17 has the changes that make it work properly with core 1.7.1? (and does it in fact work? - is there an easy way to test this with jsfiddle? Is there general guidance on compatibility anywhere?

Changed January 11, 2012 04:43AM UTC by dmethvin comment:7

Changed January 11, 2012 09:31PM UTC by gvwalsh comment:8

I have now tested UI 1.8.17 / core 1.7.1 and the problem is in fact gone! ...i.e. the autocompleteselect event is now caught by delegate('input' ...

However, I am very curious as to the nature of the change in the core that provoked this problem and whether there are other subtle bugs to be expected in user code. It appears given my experiment with bind where the target seems to have changed from the INPUT element to the A element it appears that the new event handling model of 1.7.1 may provoke other problems in previously working code.

I also question the compatibility philosophy expressed by rwaldron. At the time Yii 1.1.9 was released there was no released UI 1.8.17 in existance and 1.8.16 was the best that could be had. I don't think there was any general awareness that there were incompatibilities.

Changed January 11, 2012 10:55PM UTC by dmethvin comment:9

We have more than 5,000 unit tests for jQuery, and we run the jQuery UI unit tests before a release as well, plus we plead with the entire community to please please pretty-please-with-sugar-on-top test the pre-release versions before we go final--for example, you tested with the pre-release versions, right?

And then we ship. When someone finds a bug that wasn't covered by one of the existing tests, the best we can do is to fix it and add some more unit tests to ensure it doesn't happen again.

If we had a time machine, we could do much better of course. I would send rwaldron back to 2011 to insert the new unit tests into the 1.6 branch so that we would not introduce those bugs in 1.7. But then he would get cocky and decide to kill Bin Laden himself and really mess up the timeline because it turns out he kills Bin Laden on Friday and Rebecca Black's song becomes the patriotic anthem for the whole country and we have to listen to it before every major sporting event.

So all things considered, this bug isn't so bad.