Modify ↓
Ticket #7742 (closed bug: duplicate)
float overflow in data attribute
| Reported by: | ctapbiumabp@… | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | 1.6 |
| Component: | unfiled | Version: | 1.4.4 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
Incorrect cast in $.fn.data
here is a simple example
var div = document.createElement("div"); div.setAttribute("data-attr","1111111111111111111111111111111") document.body.appendChild(div);
console.log("getAttribute", div.getAttribute("data-attr")); 1111111111111111111111111111111
console.log("jquery.data", $(div).data("attr")); 1.111111111111111e+30
div.parentNode.removeChild(div);
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

Thanks for taking the time to contribute to the jQuery project by writing a bug report.
There is no overflow (1.111111111111111e+30 is valid float) maybe you want to try
console.log(div.getAttribute("data-attr") == $(div).data("attr")); //trueBut there are known issues with .data() related to the html5 data-* attributes. You can follow the ticket noted below for progress