has() assumes default DOM and context?
In both 1.4.2 and the latest nightly build, the implementation of has() looks like this:
- has: function( target ) {
- var targets = jQuery( target );
- return this.filter(function() {
- for ( var i = 0, l = targets.length; i < l; i++ ) {
- if ( jQuery.contains( this, targets[i] ) ) {
- return true;
- }
- }
- });
- },
Doesn't the first line ("var targets = jQuery( target );") mean that the has() method will not work when operating against anything but the DOM of the page which itself contains jQuery? In other words, should the implementation not read like this instead?
- has: function( target ) {
- var targets = jQuery( target, this );
- return this.filter(function() {
- for ( var i = 0, l = targets.length; i < l; i++ ) {
- if ( jQuery.contains( this, targets[i] ) ) {
- return true;
- }
- }
- });
- },
Thanks,
Jamey