Ticket #10061 (closed bug: duplicate)
$.data fais in case of retrieving data from a dom element which is no longer in jQuery.cache
| Reported by: | skhilko@… | Owned by: | skhilko@… |
|---|---|---|---|
| Priority: | low | Milestone: | |
| Component: | data | Version: | 1.6.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
The issue is described here http://www.datatables.net/forums/discussion/5644/issues-when-removing-datatables-from-the-dom-on-ie8/p1 It rather knotty but in short $.data fails when jquery-ui tries to trigger a "remove" event in it's own overridden $.cleanData function and fails on element which was already removed. This precondition looks like an invalid case, but the fix on jQuery side is pretty straight forward. In line 1455 of full 1.6.2 sorces there is an if condition
if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) {
return;
}
there cache[ id ] is undefined so !cache[ id ][ internalKey ] fails with NPE. Is it possible to add additional && cache[ id ] check before !cache[ id ][ internalKey ]?
Change History
comment:1 follow-up: ↓ 2 Changed 21 months ago by addyosmani
- Owner set to skhilko@…
- Priority changed from undecided to low
- Status changed from new to pending
- Component changed from unfiled to data
comment:2 in reply to: ↑ 1 Changed 21 months ago by skhilko@…
- Status changed from pending to new
Replying to addyosmani:
Thanks for submitting a ticket. Could you provide us with a reduced test case replicating the behaviour mentioned on jsFiddle so we can investigate further?
Please, here you are http://jsfiddle.net/dbdkN/8/ Fails in IE8. After you run the example press "Reinit Table" button. A error will be thrown: Line: 1455 Error: 'undefined' in null or not an object
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Thanks for submitting a ticket. Could you provide us with a reduced test case replicating the behaviour mentioned on jsFiddle so we can investigate further?