Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#8140 closed bug (duplicate)

[ IE8 ] Cache[ id ] undefined in jQuery.data in jquery-1.5.js

Reported by: mkluczka@… Owned by: mkluczka@…
Priority: blocker Milestone: 1.5.1
Component: event Version: 1.5
Keywords: Cc:
Blocked by: Blocking:

Description

I'm getting error "undefined" is empty or not an object, in Internet Explorer 8, in jQuery.data function on line 1348 in file jquery-1.5.js

if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) {

I found that, cache[ id ] is in my case undefined, and the case is not in condition.

My fix for it:

if(id !== undefined && cache[ id ] === undefined)
	cache[ id ] = [];

in line before the condition

Change History (12)

comment:1 Changed 8 years ago by jitter

Component: unfileddata
Owner: set to mkluczka@…
Status: newpending

Thanks for taking the time to contribute to the jQuery project by writing a bug report.

Please submit a reduced test case, which reproduces the issue you are experiencing, on http://jsfiddle.net. So that we can investigate this issue further.


How to report bugs

comment:2 Changed 8 years ago by mkluczka@…

Status: pendingnew

The error had place in our internal application, so it's not realy possible to full reproduce it somewhere else. One thing I can do, is to give backtrace:

1. $('#element').change || $('#element').click
2. Line 2127 inside jQuery.event.add method
   var elemData = jQuery._data( elem );
3. Line 1483 inside jQuery._data method
   return jQuery.data( elem, name, data, true );
4. Line 1348 inside jQuery.data method
   if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) {

comment:3 Changed 8 years ago by akottr

I've got the same problem. After debugging one hour through the jQuery code I still have no clue. And I can not provide you a small and clean sample. But I think you guys are much more savvy than me. A (not so small) sample is here http://www.akottr.de/dragtable/index-jq15.html. The page http://www.akottr.de/dragtable/index.html works fine. This page uses jQuery 1.5, too. But on this page the dragtable is a Plugin not a Widget. Maybe this bug only occurs when using the ui widget api. Changing line 1453

delete cache[ id ];     

to

cache[ id ] = {}; 

works fine for me. But I don't think that's a nice solution.

comment:4 in reply to:  3 Changed 8 years ago by jitter

Status: newpending

Replying to akottr:

I've got the same problem. After debugging one hour through the jQuery code I still have no clue. And I can not provide you a small and clean sample. But I think you guys are much more savvy than me. A (not so small) sample is here http://www.akottr.de/dragtable/index-jq15.html.

Could you (temporarily) use http://code.jquery.com/jquery-git.js (instead of 1.5) on that page and then check again if the error still occurs. There is a known regression in 1.5 which affects jQuery UI (currently it's not advised/supported to use jQuery UI 1.8.x with jQuery 1.5)

comment:5 Changed 8 years ago by akottr

Works fine. Thanks.

comment:6 Changed 8 years ago by jitter

Component: dataevent
Milestone: 1.next1.5.1
Priority: undecidedblocker
Resolution: duplicate
Status: pendingclosed

comment:7 Changed 8 years ago by jitter

Duplicate of #8123.

comment:8 Changed 8 years ago by ante.beslic@…

I am so glad I found this... I'm using jQuery version 1.6.1 and the problem user mkluczka reported persists. Although, his proposed fix does the job.

Same case, the error is happening inside an internal app module (file manager) so jsfiddle is not an option for feedback. There seems to be a problem when clicking an element when it's already clicked/selected once. This is the .click() call:

$('.myTree li span').click(function(e) {
... a lot of If-Else code ...
... e.ctrlKey, e.shiftKey used also, if it helps ...
})

Please see into this once more. Thnx for the fantastic effort so far.

comment:9 Changed 8 years ago by fred.grim@…

To add my two cents. I see this issue in 1.6.2 as well and the fix initially provided in the bug report stops the unhandled exception. However .data still loses data in IE8

comment:10 Changed 7 years ago by mike.m.lin@…

This is still a problem for me in jQuery 1.7.2 using IE8. Here's an example in jsFiddle: http://jsfiddle.net/HwGfk/4/

comment:11 Changed 7 years ago by dmethvin

@mike.m.lin, print out the id value: http://jsfiddle.net/HwGfk/5/

The rest is an exercise left to the reader, but it is not a jQuery bug.

comment:12 in reply to:  11 Changed 7 years ago by mike.m.lin@…

@dmethvin, I see _my_ problem. Thanks for the response ;)

Replying to dmethvin:

@mike.m.lin, print out the id value: http://jsfiddle.net/HwGfk/5/

The rest is an exercise left to the reader, but it is not a jQuery bug.

Note: See TracTickets for help on using tickets.