#10144 closed bug (duplicate)
Erroneous return in .data()
Reported by: | arcanis | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.6.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Hello,
There is a bug in the jQuery.data() function. Minimal showcase here : http://jsfiddle.net/NB2Ln/1/
It happens if the data key is in camelcase, and if the content can be implicitely casted to false. If it happens, any call to the getter of the data will return 'undefined' instead of the real value.
The problem is at line 1516 of the 1.6.2 development source code :
thisCache[ jQuery.camelCase( name ) ] || thisCache[ name ]
In the jsfiddle, this line will be evaluated as zero or undefined, and the return value of such operation is undefined.
You should do something like
thisCache[ jQuery.camelCase( name ) ] !== undefined ? thisCache[ jQuery.camelCase( name ) ] || thisCache[ name ] :
Change History (4)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
In the ticket, I've forgotten a word :
It happens if the data key is NOT in camelcase
(sorry)
comment:3 Changed 11 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Should be fixed in 1.6.3.
Note : developers can bypass this bug by using names which are not modified when calling jQuery.camelCase (so using CamelCase name is fine, there will be no conversion).