Skip to main content

Bug Tracker

Side navigation

#7742 closed bug (duplicate)

Opened December 09, 2010 09:42PM UTC

Closed December 09, 2010 11:14PM UTC

Last modified December 10, 2010 10:31AM UTC

float overflow in data attribute

Reported by: ctapbiumabp@gmail.com 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);

Attachments (0)
Change History (3)

Changed December 09, 2010 11:14PM UTC by jitter comment:1

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

Changed December 09, 2010 11:14PM UTC by jitter comment:2

Duplicate of #7579.

Changed December 10, 2010 10:31AM UTC by anonymous comment:3

thx ;)