X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fjquery%2Fjquery.js;h=44eedf2525c80d8a0205f06c3b16396d5f36c000;hb=c119a80ea37a6940ec55dfb7b9f9b296800c7928;hp=35a6ceb2b4562373e17ca112910b0e2a98ed0b7d;hpb=98e8ea3186e3b57955e94364c454de40f458ea0a;p=jquery.git
diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js
index 35a6ceb..44eedf2 100644
--- a/src/jquery/jquery.js
+++ b/src/jquery/jquery.js
@@ -56,7 +56,7 @@ var jQuery = function(a,c) {
}
// Watch for when an array is passed in
- this.get( a.constructor == Array || a.length && !a.nodeType && a[0] != undefined && a[0].nodeType ?
+ this.get( a.constructor == Array || a.length && a != window && !a.nodeType && a[0] != undefined && a[0].nodeType ?
// Assume that it is an array of DOM Elements
jQuery.merge( a, [] ) :
@@ -944,12 +944,15 @@ jQuery.fn = jQuery.prototype = {
* @result $("p").find("span").end() == [
...
]
*
* @test ok( 'Yahoo' == $('#yahoo').parent().end().text(), 'Check for end' );
+ * ok( $('#yahoo').end(), 'Check for end with nothing to end' );
*
* @name end
* @type jQuery
* @cat DOM/Traversing
*/
end: function() {
+ if( !(this.stack && this.stack.length) )
+ return this;
return this.get( this.stack.pop() );
},
@@ -1469,7 +1472,7 @@ jQuery.extend({
if ( p == "height" || p == "width" ) {
var old = {}, oHeight, oWidth, d = ["Top","Bottom","Right","Left"];
- for ( var i in d ) {
+ for ( var i=0; i|/", "jQuery.sibling(a.firstChild)",
"\\+", "jQuery.sibling(a).next",
"~", function(a){
- var r = [];
var s = jQuery.sibling(a);
- if ( s.n > 0 )
- for ( var i = s.n; i < s.length; i++ )
- r.push( s[i] );
- return r;
+ return s.n >= 0 ? s.slice(s.n+1) : [];
}
],
@@ -1900,7 +1899,7 @@ jQuery.extend({
return elem[fix[name]];
} else if( value == undefined && jQuery.browser.msie && elem.nodeName && elem.nodeName.toUpperCase() == 'FORM' && (name == 'action' || name == 'method') ) {
return elem.getAttributeNode(name).nodeValue;
- } else if ( (jQuery.browser.msie || elem.getAttribute != undefined) && elem.tagName ) { // IE elem.getAttribute passes even for style; Do not "call" elem.getAttribute in IE <- weird crap
+ } else if ( elem.tagName ) { // IE elem.getAttribute passes even for style
if ( value != undefined ) elem.setAttribute( name, value );
return elem.getAttribute( name );
} else {
@@ -2242,8 +2241,8 @@ jQuery.extend({
},
trigger: function(type,data,element) {
- // Touch up the incoming data
- data = data || [];
+ // Clone the incoming data, if any
+ data = $.merge([], data || []);
// Handle a global trigger
if ( !element ) {
@@ -3315,8 +3314,8 @@ jQuery.macros = {
},
/**
- * Adds the specified class if it is present, removes it if it is
- * not present.
+ * Adds the specified class if it is not present, removes it if it is
+ * present.
*
* @example $("p").toggleClass("selected")
* @before Hello
Hello Again