Side navigation
#6166 closed bug (fixed)
Opened February 24, 2010 07:23PM UTC
Closed February 26, 2010 05:35PM UTC
typeof($(EXPR).data('undefinedKey')) returns object vs 'undefined' now
Reported by: | scunliffe | Owned by: | |
---|---|---|---|
Priority: | Milestone: | 1.4.3 | |
Component: | data | Version: | 1.4.2 |
Keywords: | data | Cc: | |
Blocked by: | Blocking: |
Description
I could be wrong but I believe a behavior has changed from jQuery 1.4.1 to 1.4.2
I have code similar to this:
if(typeof($('#someID').data('somekey')) == 'undefined'){
alert('1. NOT SET');
} else {
alert('2. IS SET');
}
In 1.4.1 (and previous) if the key wasn't set, the typeof test returned undefined (e.g. Alert #1)
In 1.4.2 I get into the else block, because the typeof is returning 'object'
Did I miss a key part of the 1.4.x upgrade notes? if it was changed on purpose, how does one tell if the "key" is not set yet?
Attachments (0)
Change History (1)
Changed February 26, 2010 05:35PM UTC by comment:1
component: | unfiled → data |
---|---|
milestone: | 1.4.2 → 1.4.3 |
resolution: | → fixed |
status: | new → closed |
version: | 1.4.1 → 1.4.2 |
Fixed.
http://github.com/jquery/jquery/commit/9e06903a99caf5619d0db858ed3d24f0e6ee15db