Bug Tracker

Opened 10 years ago

Closed 10 years ago

#6308 closed bug (duplicate)

.data() inconsistent return value

Reported by: Screeze Owned by:
Priority: Milestone: 1.4.3
Component: data Version: 1.4.2
Keywords: Cc:
Blocked by: Blocking:

Description

The .data() function returns inconsistent values: If you try to load a not-existing-value of an object, which does not have ANY values stored, it will return null. But if this object has ANY value stored in it, and you load the not-existing-value, it returns "undefined".

Example:


<div id="div1">test</div> <script type="text/javascript">

console.log($("#div1").data("test")); -> result: null

$("#div1").data("abcdefg", 1); console.log($("#div1").data("test")); -> result: 'undefined'

</script>


That's not what it should be like, is it?

Change History (1)

comment:1 Changed 10 years ago by dmethvin

Resolution: duplicate
Status: newclosed

Duplicate of #6304.

Note: See TracTickets for help on using tickets.