I am seeing the following behavior in the Chrome dev tools:
var $el = $("<div>", { "data-row-idx": 1, "data-col-idx": 2 })
// n.fn.init [div]
$el.data("row-idx")
// 1
$el.data("col-idx")
// 2
["row-idx", "col-idx"].map(function(x) { return $el.data(x) })
// (2) [1, 2]
["row-idx", "col-idx"].map($el.data)
// jquery.min.js:3 Uncaught TypeError: this.each is not a function
// at data (jquery.min.js:3)
// at Array.map (<anonymous>)
// at <anonymous>:1:24
// data @ jquery.min.js:3
[1,2,3].map(function(x) { return x})
// (3) [1, 2, 3]
I thought that:
["row-idx", "col-idx"].map(function(x) { return $el.data(x) })
and
["row-idx", "col-idx"].map($el.data)
were equivalent. Is this not so?