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?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---