}
// 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, [] ) :
* @result $("p").find("span").end() == [ <p>...</p> ]
*
* @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() );
},
if ( p == "height" || p == "width" ) {
var old = {}, oHeight, oWidth, d = ["Top","Bottom","Right","Left"];
- for ( var i in d ) {
+ for ( var i=0; i<d.length; i++ ) {
old["padding" + d[i]] = 0;
old["border" + d[i] + "Width"] = 0;
}
* t( "Attribute Exists", "a[@title]", ["google"] );
* t( "Attribute Exists", "*[@title]", ["google"] );
* t( "Attribute Exists", "[@title]", ["google"] );
- *
- * t( "Non-existing part of attribute", "[@name*=bla]", [] );
- * t( "Non-existing start of attribute", "[@name^=bla]", [] );
- * t( "Non-existing end of attribute", "[@name$=bla]", [] );
*
* t( "Attribute Equals", "a[@rel='bookmark']", ["simon1"] );
* t( "Attribute Equals", 'a[@rel="bookmark"]', ["simon1"] );
* t( "Attribute Exists", "//a[@title]", ["google"] );
* t( "Attribute Equals", "//a[@rel='bookmark']", ["simon1"] );
* t( "Parent Axis", "//p/..", ["main","foo"] );
- * t( "Sibling Axis", "//p/../", ["firstp","ap","foo","first","firstUL","empty","form","sndp","en","sap"] );
- * t( "Sibling Axis", "//p/../*", ["firstp","ap","foo","first","firstUL","empty","form","sndp","en","sap"] );
+ * t( "Sibling Axis", "//p/../", ["firstp","ap","foo","first","firstUL","empty","form","floatTest","sndp","en","sap"] );
+ * t( "Sibling Axis", "//p/../*", ["firstp","ap","foo","first","firstUL","empty","form","floatTest","sndp","en","sap"] );
* t( "Has Children", "//p[a]", ["firstp","ap","en","sap"] );
*
* t( "nth Element", "p:nth(1)", ["ap"] );
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 ( elem.getAttribute != undefined && elem.tagName ) { // IE elem.getAttribute passes even for style
+ } else if ( elem.tagName ) { // IE elem.getAttribute passes even for style
if ( value != undefined ) elem.setAttribute( name, value );
return elem.getAttribute( name );
} else {
},
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 ) {
},
/**
- * 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 <p>Hello</p><p class="selected">Hello Again</p>