$.fn.foo = function() {
console.log($(this));
};
$("#foo").foo();
$(document).foo();
How can I tell weather $(this)
inside the function is $(document)
or not?
In this question, people suggested
1. if (obj instanceof HTMLDocument)
2. if (Object.prototype.toString.call(obj) == "[object HTMLDocument]")
3. $obj.is('html')
but none of them works.