News for hackers. Stuff that matters.
Re:Don't use the jQuery .data() method. Use .attr() instead. by underwater on Sunday December 18, 2011 @05:56PM (#3367772)
His example is unclear, but he's complaining about the behavior of conditionally casting the initial data values based on pattern matching.

   <div id="test" data-foo="1.1"> 
   $('#test').data('bar', '1.1');
   typeof $('#test').data('foo'); // number
   typeof $('#test').data('bar'); // string
If the data-foo value is user input, then converting it to a number might not be expected. E.g.

   <div data-emoticon="0.0" />

There are no comments on this comment yet.