.is()-method should support another jquery object as first parameter

.is()-method should support another jquery object as first parameter


I needed to check if one element was the same as another. Currently, $
(aSel).is(aJqueryObjectMadeFromASelector) erros out, so you got to do
a $(aSel).attr('id') == aJqueryObjectMadeFromASelector.attr('id') for
it to work.
It would be much better if the jQuery.fn.is-method could support
another jquery object.
Currently I made my own rudimentary implementation, used like this:
target.isSameAs(toolTip)
jQuery.fn.extend({
isSameAs:function(selectorOrJqueryObject) {
selectorOrJqueryObject = $(selectorOrJqueryObject);
//can't be equal to nothing, abort
if(this.length == 0 || selectorOrJqueryObject.length == 0)
{
return false;
}
return this.get(0) == selectorOrJqueryObject.get(0);
}
});
Obiously, this should be improved upon by implementing it in the is()-
method and cycling through every element of the
selectorOrJqueryObject. I've heared some rumor about a new selector
engine supposedly to support this, but information is vague. This
should be easy to support, no?