Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#7742 closed bug (duplicate)

float overflow in data attribute

Reported by: [email protected] Owned by:
Priority: undecided Milestone: 1.6
Component: unfiled Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:

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 (3)

comment:1 Changed 12 years ago by jitter

Resolution: duplicate
Status: newclosed

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")); //true

But there are known issues with .data() related to the html5 data-* attributes. You can follow the ticket noted below for progress

comment:2 Changed 12 years ago by jitter

Duplicate of #7579.

comment:3 Changed 12 years ago by anonymous

thx ;)

Note: See TracTickets for help on using tickets.