Make sure subclass is a proper subclass not just subclassing the fn methods. Fixes #7979.

This commit is contained in:
Digitalxero 2011-01-27 13:35:06 -05:00 committed by jeresig
parent 7f95a730e5
commit e00f74c43b
2 changed files with 52 additions and 1 deletions

View file

@ -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;