I have just encountered some very disturbing behavior in jQuery 1.6.2 that I hope someone can explain. Given the following markup...
<div id="test" data-test=" 01">Test</div>
Can someone tell me why accessing the attribute through .data() causes it to be parsed to an int?
var t = $("#test").data("test");
alert(t); // shows "1"
t = $("#test").attr("data-test");
alert(t); // shows " 01"
Of course I have proof on jsFiddle of this behavior.