Search and Top Navigation
#10525 closed bug (fixed)
Opened August 07, 2014 05:10PM UTC
Closed August 08, 2014 12:48PM UTC
Last modified August 08, 2014 12:49PM UTC
Autocomplete - stray reference to jQuery.trim
Reported by: | pxc | Owned by: | pxc |
---|---|---|---|
Priority: | minor | Milestone: | 1.11.1 |
Component: | ui.autocomplete | Version: | 1.11.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Produces "TypeError: jQuery is undefined" when using jquery migrate plugin.
Replacing jQuery.trim() with $.trim() seems to remove the console warning.
Hopefully that suggested fix is correct and so trivial you dont need this info:
Its the only reference to jQuery.trim in the autocomplete code, but in the unlikely event that you're struggling to find it, its in the menufocus handler near the comment "// Announce the value in the liveRegion".
To reproduce
1. enable migrate plugin!
2. type into an autocomplete to produce drop down options
3. mouse over the options, warning for each option elem
It occurred on Firefox 20 on 32-bit linux. Its very probably not relevant.
Attachments (0)
Change History (7)
Changed August 07, 2014 05:23PM UTC by comment:1
owner: | → pxc |
---|---|
status: | new → pending |
Changed August 07, 2014 05:50PM UTC by comment:2
status: | pending → new |
---|
Sorry, I forgot the one other vital piece of info - you have to $.noConflict() too. I dont have a fiddle account but this mod to your example should do it ...
var $j = $.noConflict(true);
var availableTags = ["ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme"];
$j("#autocomplete").autocomplete({
source: availableTags
});
Changed August 07, 2014 08:07PM UTC by comment:3
status: | new → pending |
---|
You don't need an account to play with the test case. When you can recreate the problem click the “Update” button and you'll get a URL you can share.
I don't have any issues when I add a
noConflictcall: http://jsfiddle.net/tj_vantoll/s390cfnr/1/.
Changed August 08, 2014 10:54AM UTC by comment:4
status: | pending → new |
---|
Your updated example (thanks!) produces a javascript console error message
- "TypeError: jQuery is undefined" on firefox v34 64bit on win 7, and firefox v20 32bit on ubuntu
- "Uncaught TypeError: Cannot read property 'trim' of undefined " on chrome v36 Win7 and chrome v27 32bit on ubuntu
- "Uncaught exception: TypeError: Cannot convert 'jQuery' to object" on opera v12.16 win7 and v12.16 on ubuntu
I'd expect it to produce some form of console error/warning on all browser variants. Theres a syntactical namespace conflict - the call to jQuery.trim() should be $.trim() like all other calls to jQuery api in the same component package.
The lines in error seem to be related to aria screen readers. I doubt it causes any noticeable functional problem on non-impaired kit, you wont "see" anything broken visually.
Changed August 08, 2014 12:46PM UTC by comment:5
status: | new → open |
---|---|
summary: | jqueryui autocomplete - stray reference to jQuery.trim → Autocomplete - stray reference to jQuery.trim |
Ah ok. This isn't happening because of the migrate plugin; it's happening because you're passing
trueto
noConflict(), which removes the
jQueryglobal variable. We require that global variable be in place, but I'm fine switching to
$.trimfor consistency with the rest of the codebase.
Changed August 08, 2014 12:48PM UTC by comment:6
resolution: | → fixed |
---|---|
status: | open → closed |
Autocomplete: Use $.trim
instead of jQuery.trim
for consistency
Fixes #10525
Changeset: 36e4bfd516c10140d8517ed9e2eb067be2e5c837
Changed August 08, 2014 12:49PM UTC by comment:7
milestone: | none → 1.11.1 |
---|
Hi pxc,
Thanks for taking the time to contribute to jQuery UI. Could you create a test case that shows this issue? I'm not seeing it in my test: http://jsfiddle.net/tj_vantoll/s390cfnr/.