Bug Tracker

Modify

Ticket #5971 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

Make sure jQuery.data( elem ) always returns an object

Reported by: john Owned by:
Priority: major Milestone: 1.4.2
Component: data Version: 1.4.1
Keywords: Cc:
Blocking: Blocked by:

Description

Right now it'll return null if no data object exists.

Change History

comment:1 Changed 3 years ago by john

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

comment:2 Changed 3 years ago by stimpy77

  • Status changed from closed to reopened
  • Resolution fixed deleted

I just came across another bug, where page unload pukes on this line in jQuery 1.4.2:

var events = jQuery.data(this, "events"), handlers = events[ event.type ];

.. should be ..

var events = jQuery.data(this, "events"), handlers = events ? events[ event.type ] : null;

I logged in to report this bug but it seems this (#5971) should have fixed this. I may be misunderstanding "Milestone" field but this defect remains in 1.4.2.

comment:3 Changed 3 years ago by john

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

You're mis-understanding the bug - that's a separate case where you're requesting a specific property where it (apparently) doesn't exist any more. What you're describing is ticket #6163 and it's already been fixed.

comment:4 Changed 3 years ago by stimpy77

Added #6243

comment:5 Changed 3 years ago by stimpy77

.. and shouldn't have. (oops)

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.