Bug Tracker

Ticket #6444 (closed bug: fixed)

Opened 4 years ago

Last modified 3 years ago

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:
Blocking: Blocked by:

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

comment:1 in reply to: ↑ description ; follow-up: ↓ 2 Changed 4 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 4 years ago by StefanKendall

comment:3 Changed 4 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to fixed

Thanks!

Note: See TracTickets for help on using tickets.