jquery core: simplified the code using the new jQuery.makeArray from [5314] where possible.
This commit is contained in:
parent
ba391eccf9
commit
25f9974cee
13
src/core.js
13
src/core.js
|
@ -86,17 +86,8 @@ jQuery.fn = jQuery.prototype = {
|
||||||
// Shortcut for document ready
|
// Shortcut for document ready
|
||||||
} else if ( jQuery.isFunction( selector ) )
|
} else if ( jQuery.isFunction( selector ) )
|
||||||
return new jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );
|
return new jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );
|
||||||
|
|
||||||
return this.setArray(
|
return this.setArray(jQuery.makeArray(selector));
|
||||||
// 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 ] );
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// The current version of jQuery being used
|
// The current version of jQuery being used
|
||||||
|
|
|
@ -160,7 +160,7 @@ jQuery.event = {
|
||||||
|
|
||||||
trigger: function(type, data, elem, donative, extra) {
|
trigger: function(type, data, elem, donative, extra) {
|
||||||
// Clone the incoming data, if any
|
// Clone the incoming data, if any
|
||||||
data = jQuery.makeArray(data || []);
|
data = jQuery.makeArray(data);
|
||||||
|
|
||||||
if ( type.indexOf("!") >= 0 ) {
|
if ( type.indexOf("!") >= 0 ) {
|
||||||
type = type.slice(0, -1);
|
type = type.slice(0, -1);
|
||||||
|
|
|
@ -188,8 +188,7 @@ var queue = function( elem, type, array ) {
|
||||||
var q = jQuery.data( elem, type + "queue" );
|
var q = jQuery.data( elem, type + "queue" );
|
||||||
|
|
||||||
if ( !q || array )
|
if ( !q || array )
|
||||||
q = jQuery.data( elem, type + "queue",
|
q = jQuery.data( elem, type + "queue", jQuery.makeArray(array) );
|
||||||
array ? jQuery.makeArray(array) : [] );
|
|
||||||
|
|
||||||
return q;
|
return q;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue