git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Changed .get(-Number) to use .slice() instead of .toArray() (which doesn't take any...
[jquery.git]
/
src
/
core.js
diff --git
a/src/core.js
b/src/core.js
index
88c0437
..
cb9b528
100644
(file)
--- a/
src/core.js
+++ b/
src/core.js
@@
-128,7
+128,9
@@
jQuery.fn = jQuery.prototype = {
return this.length;
},
return this.length;
},
- toArray: slice,
+ toArray: function(){
+ return slice.call( this, 0 );
+ },
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
@@
-139,7
+141,7
@@
jQuery.fn = jQuery.prototype = {
this.toArray() :
// Return just the object
this.toArray() :
// Return just the object
- ( num < 0 ? this.toArray(num)[ 0 ] : this[ num ] );
+ ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] );
},
// Take an array of elements and push it onto the stack
},
// Take an array of elements and push it onto the stack
@@
-251,10
+253,15
@@
jQuery.extend = jQuery.fn.extend = function() {
if ( deep && copy && typeof copy === "object" && !copy.nodeType ) {
var clone;
if ( deep && copy && typeof copy === "object" && !copy.nodeType ) {
var clone;
- if( src ) clone = src;
- else if( jQuery.isArray(copy) ) clone = [ ];
- else if( jQuery.isObject(copy) ) clone = { };
- else clone = copy;
+ if ( src ) {
+ clone = src;
+ } else if ( jQuery.isArray(copy) ) {
+ clone = [];
+ } else if ( jQuery.isObject(copy) ) {
+ clone = {};
+ } else {
+ clone = copy;
+ }
// Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy );
// Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy );
@@
-298,15
+305,15
@@
jQuery.extend({
},
isEmptyObject: function( obj ) {
},
isEmptyObject: function( obj ) {
- for(var name in obj)
+ for ( var name in obj ) {
return false;
return false;
+ }
return true;
},
// check if an element is in a (or is an) XML document
isXMLDoc: function( elem ) {
return true;
},
// check if an element is in a (or is an) XML document
isXMLDoc: function( elem ) {
- return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
- !!elem.ownerDocument && elem.ownerDocument.documentElement.nodeName !== "HTML";
+ return (elem.ownerDocument || elem).documentElement.nodeName !== "HTML";
},
// Evalulates a script in a global context
},
// Evalulates a script in a global context
@@
-318,6
+325,7
@@
jQuery.extend({
script = document.createElement("script");
script.type = "text/javascript";
script = document.createElement("script");
script.type = "text/javascript";
+
if ( jQuery.support.scriptEval ) {
script.appendChild( document.createTextNode( data ) );
} else {
if ( jQuery.support.scriptEval ) {
script.appendChild( document.createTextNode( data ) );
} else {