3 ms·
You are not being serious, right? 1.410 === 1.41
by Flavius 15y ago
You are not being serious, right?
1.410 === 1.41
- pxm 15y agoYep, latchkey, I think you might want to rethink the article. As others have pointed out, you're seeing JavaScript's behaviour, not jQuery's. And this: elem.data('foo', { 'a':1, 'b':2 }); elem.data('foo'); // Returns the object Is certainly more desirable than: elem.attr('foo', { 'a':1, 'b':2 }); elem.attr('foo'); // Returns "[object Object]"
- underwater 15y agoHis 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" />