Bug Tracker

Opened 13 years ago

Closed 13 years ago

#6259 closed bug (duplicate)

data() returns null, but undefined in Firefox after console.log()

Reported by: pjdietz Owned by:
Priority: Milestone: 1.4.3
Component: data Version: 1.4.2
Keywords: data firefox console null undefined Cc:
Blocked by: Blocking:


I noticed that in 1.4, data() now returns null instead of undefined if nothing has been set for a given key. However, in Firefox 3.6 (Mac and Win), passing an object to console.log() first, then trying to retrieve data for a non-existent key yields undefined (as was the behavior in jQuery 1.3).

Not sure if this is a Firebug problem more than a jQuery problem, but I thought it was worth looking into.

I tried this in Safari and Chrome on Mac and got null before and after the conole.log() call.

Here's some sample code I used to test this:

$(document).ready(function () {

var myElement, myData;

myElement = $("#MyElement");

myData = myElement.data("myKey"); console.log(myData); null


myData = myElement.data("myKey"); console.log(myData); undefined


Change History (1)

comment:1 Changed 13 years ago by john

Component: coredata
Resolution: duplicate
Status: newclosed

This is a duplicate of #6166.

Note: See TracTickets for help on using tickets.