Opened 13 years ago
Closed 13 years ago
#6166 closed bug (fixed)
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?
Change History (1)
comment:1 Changed 13 years ago by
Component: | unfiled → data |
---|---|
Milestone: | 1.4.2 → 1.4.3 |
Resolution: | → fixed |
Status: | new → closed |
Version: | 1.4.1 → 1.4.2 |
Note: See
TracTickets for help on using
tickets.
Fixed. http://github.com/jquery/jquery/commit/9e06903a99caf5619d0db858ed3d24f0e6ee15db