From 25f9974cee5874d10df32f2d16fb985181e0c077 Mon Sep 17 00:00:00 2001 From: Ariel Flesler Date: Thu, 24 Apr 2008 21:46:22 +0000 Subject: [PATCH] jquery core: simplified the code using the new jQuery.makeArray from [5314] where possible. --- src/core.js | 13 ++----------- src/event.js | 2 +- src/fx.js | 3 +-- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/core.js b/src/core.js index 072642f63..66efc182c 100644 --- a/src/core.js +++ b/src/core.js @@ -86,17 +86,8 @@ jQuery.fn = jQuery.prototype = { // Shortcut for document ready } else if ( jQuery.isFunction( selector ) ) return new jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector ); - - return this.setArray( - // HANDLE: $(array) - selector.constructor == Array && selector || - - // HANDLE: $(arraylike) - // Watch for when an array-like object, contains DOM nodes, is passed in as the selector - (selector.jquery || selector.length && selector != window && !selector.nodeType && selector[0] != undefined && selector[0].nodeType) && jQuery.makeArray( selector ) || - - // HANDLE: $(*) - [ selector ] ); + + return this.setArray(jQuery.makeArray(selector)); }, // The current version of jQuery being used diff --git a/src/event.js b/src/event.js index 25161d3fe..5b77e8c51 100644 --- a/src/event.js +++ b/src/event.js @@ -160,7 +160,7 @@ jQuery.event = { trigger: function(type, data, elem, donative, extra) { // Clone the incoming data, if any - data = jQuery.makeArray(data || []); + data = jQuery.makeArray(data); if ( type.indexOf("!") >= 0 ) { type = type.slice(0, -1); diff --git a/src/fx.js b/src/fx.js index 64cfbc625..824616afb 100644 --- a/src/fx.js +++ b/src/fx.js @@ -188,8 +188,7 @@ var queue = function( elem, type, array ) { var q = jQuery.data( elem, type + "queue" ); if ( !q || array ) - q = jQuery.data( elem, type + "queue", - array ? jQuery.makeArray(array) : [] ); + q = jQuery.data( elem, type + "queue", jQuery.makeArray(array) ); return q; }; -- 2.39.5