Skip to main content

Bug Tracker

Side navigation

#6259 closed bug (duplicate)

Opened March 10, 2010 08:10PM UTC

Closed March 10, 2010 09:47PM UTC

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:
Description

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

console.log(myElement);

myData = myElement.data("myKey");

console.log(myData); undefined

});

Attachments (0)
Change History (1)

Changed March 10, 2010 09:47PM UTC by john comment:1

component: coredata
resolution: → duplicate
status: newclosed

This is a duplicate of #6166.