Re:Don't use the jQuery .data() method. Use .attr() instead.
by stickfigure on Sunday December 18, 2011 @09:51PM
(#3368262)
That may be the documented behavior, but that doesn't make it the correct behavior. The problem is that we have a typeless language applying arbitrary type detection to strings... and it will invariably guess wrong.
A string of "1.410" is not the same as a float of 1.41. Running "1.410" full-circle through data() corrupts the input string. When you have data that has been entered by a user, you can't guarantee that it's not something that will happen to autoconvert.
This behavior is totally broken and should never be used. It will work 99.95% of the time, then fail in bizarre ways when a user types in something magic. These are the worst bugs in the world to hunt down. This really shouldn't be in jquery.
A string of "1.410" is not the same as a float of 1.41. Running "1.410" full-circle through data() corrupts the input string. When you have data that has been entered by a user, you can't guarantee that it's not something that will happen to autoconvert.
This behavior is totally broken and should never be used. It will work 99.95% of the time, then fail in bizarre ways when a user types in something magic. These are the worst bugs in the world to hunt down. This really shouldn't be in jquery.