Two questions really...
Firstly, which is the better coding style when writing jQuery functions which take object params, should the function take a jQuery object or is it better to pass a standard JavaScript object and have the function itself do the wrapping? I guess I'm just asking if there is a standard here, since it might not always be obvious to someone who wants to call the function.
And secondly, how do you test if an object is a jQuery object? Ideally it would be nice if the function could take either, so...
function(obj) {
var $obj;
if (isJQuery(obj)) {
$obj = obj;
}
else {
$obj = $(obj);
}
// ....
}
or do you even need to do this? will $(obj) simply return if the object is already a jQuery object, so you can always attempt to wrap and it doesn't matter?