Make sure subclass is a proper subclass not just subclassing the fn methods. Fixes #7979.
This commit is contained in:
parent
7f95a730e5
commit
e00f74c43b
2 changed files with 52 additions and 1 deletions
|
@ -961,14 +961,16 @@ jQuery.extend({
|
|||
function jQuerySubclass( selector, context ) {
|
||||
return new jQuerySubclass.fn.init( selector, context );
|
||||
}
|
||||
jQuery.extend( true, jQuerySubclass, this );
|
||||
jQuerySubclass.superclass = this;
|
||||
jQuerySubclass.fn = jQuerySubclass.prototype = this();
|
||||
jQuerySubclass.fn.constructor = jQuerySubclass;
|
||||
jQuerySubclass.subclass = this.subclass;
|
||||
jQuerySubclass.fn.init = function init( selector, context ) {
|
||||
if (context && context instanceof jQuery && !(context instanceof jQuerySubclass)){
|
||||
if ( context && context instanceof jQuery && !(context instanceof jQuerySubclass) ) {
|
||||
context = jQuerySubclass(context);
|
||||
}
|
||||
|
||||
return jQuery.fn.init.call( this, selector, context, rootjQuerySubclass );
|
||||
};
|
||||
jQuerySubclass.fn.init.prototype = jQuerySubclass.fn;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue