From 672701add1ddaf3988d84beaee6508f1e738def1 Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Fri, 29 Jun 2012 09:37:33 -0700 Subject: [PATCH] Move jQuery.sub to deprecated.js, because it is. --- src/core.js | 21 --------------------- src/deprecated.js | 21 +++++++++++++++++++++ test/unit/core.js | 4 ++++ 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/core.js b/src/core.js index 1c82e4e78..a0fdac823 100644 --- a/src/core.js +++ b/src/core.js @@ -788,27 +788,6 @@ jQuery.extend({ now: function() { return ( new Date() ).getTime(); - }, - - sub: function() { - function jQuerySub( selector, context ) { - return new jQuerySub.fn.init( selector, context ); - } - jQuery.extend( true, jQuerySub, this ); - jQuerySub.superclass = this; - jQuerySub.fn = jQuerySub.prototype = this(); - jQuerySub.fn.constructor = jQuerySub; - jQuerySub.sub = this.sub; - jQuerySub.fn.init = function init( selector, context ) { - if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { - context = jQuerySub( context ); - } - - return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); - }; - jQuerySub.fn.init.prototype = jQuerySub.fn; - var rootjQuerySub = jQuerySub(document); - return jQuerySub; } }); diff --git a/src/deprecated.js b/src/deprecated.js index 04bf5bad0..d165a8724 100644 --- a/src/deprecated.js +++ b/src/deprecated.js @@ -38,4 +38,25 @@ if ( browser.webkit ) { jQuery.browser = browser; +jQuery.sub = function() { + function jQuerySub( selector, context ) { + return new jQuerySub.fn.init( selector, context ); + } + jQuery.extend( true, jQuerySub, this ); + jQuerySub.superclass = this; + jQuerySub.fn = jQuerySub.prototype = this(); + jQuerySub.fn.constructor = jQuerySub; + jQuerySub.sub = this.sub; + jQuerySub.fn.init = function init( selector, context ) { + if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { + context = jQuerySub( context ); + } + + return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); + }; + jQuerySub.fn.init.prototype = jQuerySub.fn; + var rootjQuerySub = jQuerySub(document); + return jQuerySub; +}; + })(); diff --git a/test/unit/core.js b/test/unit/core.js index 7b2ad27e7..a7c8805e2 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -1186,6 +1186,8 @@ test("jQuery.parseXML", 8, function(){ } }); +if ( jQuery.sub ) { + test("jQuery.sub() - Static Methods", function(){ expect(18); var Subclass = jQuery.sub(); @@ -1307,6 +1309,8 @@ test("jQuery.sub() - .fn Methods", function(){ }); +} // jQuery.sub + test("jQuery.camelCase()", function() { var tests = {