chuanxshi / javascript-patterns

JavaScript Design Patterns

Home Page:http://shichuan.github.io/javascript-patterns

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jQuery.data() vs. jQuery().data() should be more clear

dieseltravis opened this issue · comments

I think it just needs a bit of documentation that elem is a DOM element, not a jQuery object. Also it should be noted that using jQuery.data(domElem, "key") will not pull in the HTML5 data-* attribute data-key="value" like calling jQuery(domElem).data("key") would.

Here's an example showing how they fail:
http://jsbin.com/exapef/1/edit