Make .add() take an optional context and - if a context is specified in the root selector - use that as the base context.
This commit is contained in:
parent
ef05f44cce
commit
b0fe380cf8
2 changed files with 15 additions and 3 deletions
|
@ -68,9 +68,9 @@ jQuery.fn.extend({
|
|||
});
|
||||
},
|
||||
|
||||
add: function( selector ) {
|
||||
add: function( selector, context ) {
|
||||
var set = typeof selector === "string" ?
|
||||
jQuery( selector ) :
|
||||
jQuery( selector, context || this.context ) :
|
||||
jQuery.makeArray( selector ),
|
||||
all = jQuery.merge( this.get(), set );
|
||||
|
||||
|
@ -185,4 +185,4 @@ jQuery.extend({
|
|||
|
||||
return r;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue