Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#11178 closed bug (duplicate)

data- attribute with 18 digit or larger number

Reported by: mgramolini@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:

Description

Every digit after the 17th comes back as a zero instead of its proper value.

I am not familiar with all the uses of isNumeric so I suggest only checking values for dataAttr function

line 1996: jQuery.isNumeric( data ) && data.length < ( data.indexOf('.') != -1 ? 18 : 17 ) ? parseFloat( data ) :

Otherwise, we could just not try to convert to a number.

Change History (2)

comment:1 Changed 12 years ago by Rick Waldron

Resolution: duplicate
Status: newclosed

jQuery.fn.data() converts all string values into real JavaScript primitive and object values (string, number, boolean, object, array etc). Given this information and knowing that the largest finite integral number in JavaScript is 253, or 9007199254740992 (try adding 1 to that number, it won't work), which is 16 characters long, we can assume that numbers of that length will not be valid in JavaScript. If you need the full value, access with jQuery.fn.attr()

comment:2 Changed 12 years ago by Rick Waldron

Duplicate of #10174.

Note: See TracTickets for help on using tickets.