Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
jquery core: simplified the code using the new jQuery.makeArray from …
…[5314] where possible.
  • Loading branch information
flesler committed Apr 24, 2008
1 parent ba391ec commit 25f9974
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
13 changes: 2 additions & 11 deletions src/core.js
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/event.js
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions src/fx.js
Expand Up @@ -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;
};
Expand Down

0 comments on commit 25f9974

Please sign in to comment.