diff options
author | Digitalxero <digitalxero> | 2011-01-27 13:35:06 -0500 |
---|---|---|
committer | jeresig <jeresig@gmail.com> | 2011-01-27 13:35:06 -0500 |
commit | e00f74c43bf58132be01c6417c6126a5bc085899 (patch) | |
tree | 14b028322a24e2536f372d7274ecb5f1a317aa6e /src | |
parent | 7f95a730e50260c60e7d3ee4fa53cbe29258e6b6 (diff) | |
download | jquery-e00f74c43bf58132be01c6417c6126a5bc085899.tar.gz jquery-e00f74c43bf58132be01c6417c6126a5bc085899.zip |
Make sure subclass is a proper subclass not just subclassing the fn methods. Fixes #7979.
Diffstat (limited to 'src')
-rw-r--r-- | src/core.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/core.js b/src/core.js index 422b68876..2e0ece1b3 100644 --- a/src/core.js +++ b/src/core.js @@ -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; |