Bug Tracker

Modify

Ticket #7742 (closed bug: duplicate)

Opened 3 years ago

Last modified 3 years ago

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

comment:1 Changed 3 years ago by jitter

  • Status changed from new to closed
  • Resolution set to duplicate

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 3 years ago by jitter

Duplicate of #7579.

comment:3 Changed 3 years ago by anonymous

thx ;)

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.