Ticket #9917 (closed bug: duplicate)
$.data returns undefined for any stored false value
|Reported by:||anonymous||Owned by:||anonymous|
If you store 0, false or null as a value for the data, it will always return undefined. Reason being, if it is stored as a camelized key, the below condition will always fail, and then $.data will always return the nonexisting non-camelized data, which is undefined.
The offending code is this, at the end of the $.data function: thisCache[ jQuery.camelCase( name ) ] || thisCache[ name ]
This problem is especially bad, if 0 is stored as the data, and during retrieval, it is expected to be of a numeric type. With undefined, any numerical expression will result in NaN.
The above code should be changed to :
var camelName = jQuery.camelCase(name); camelName in thisCache ? thisCache[camelName] : thisCache[name]
- Owner set to anonymous
- Priority changed from undecided to low
- Status changed from new to pending
- Component changed from unfiled to data
- Status changed from pending to closed
- Resolution set to duplicate