Bug Tracker

Opened 13 years ago

Closed 13 years ago

Last modified 11 years ago

#6444 closed bug (fixed)

jQuery.cleanData calls on null objects (causing script breakage)

Reported by: StefanKendall Owned by:
Priority: Milestone: 1.4.2
Component: core Version: 1.4.2
Keywords: cleanData Cc:
Blocked by: Blocking:

Description

The 'cleanData' method references a possibly null cache item and makes calls on it under certain odd edge cases. Specifically, this snippet of code in the cleanData method is at fault:

if ( id ) { data = cache[ id ]; if ( data.events ) {

In my execution, I've encountered data = null, which causes script breakage. If this is modified as such, no breakage occurs:

if ( id ) { data = cache[ id ]; if ( data && data.events ) {

I'm unsure why the cache is not populated, and this may be a separate issue entirely, but adding this guard prevents against null cache items.

Change History (3)

comment:1 in reply to:  description ; Changed 13 years ago by StefanKendall

This also fails in 1.4.3pre. I've only noticed an invalid cache in IE6/7/8, but regardless, guarding against null data resolves the issue. In 1.3.2, I do not see any breakage in my application, although I haven't done any extensive testing or investigation to see if similar jQuery code paths are hit at all.

comment:2 in reply to:  1 Changed 13 years ago by StefanKendall

comment:3 Changed 13 years ago by dmethvin

Resolution: fixed
Status: newclosed

Thanks!

Note: See TracTickets for help on using tickets.