X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fattributes.js;h=93e043368c1cfe5f98a8cdb04a755d21f14adf14;hb=b7d4e0e46cb2cad6f400173cd09ce44d1b8ad04e;hp=041bb29fcd3e8fb814fdb04f9291f6a53a6784bd;hpb=0d5c3a68a092401089c9242bdafdb1b2534feb6a;p=jquery.git diff --git a/src/attributes.js b/src/attributes.js index 041bb29..93e0433 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -100,15 +100,13 @@ jQuery.fn.extend({ return; if ( jQuery.isArray(val) && /radio|checkbox/.test( this.type ) ) - this.checked = (jQuery.inArray(this.value, val) >= 0 || - jQuery.inArray(this.name, val) >= 0); + this.checked = jQuery.inArray(this.value || this.name, val) >= 0; else if ( jQuery.nodeName( this, "select" ) ) { var values = jQuery.makeArray(val); jQuery( "option", this ).each(function(){ - this.selected = (jQuery.inArray( this.value, values ) >= 0 || - jQuery.inArray( this.text, values ) >= 0); + this.selected = jQuery.inArray( this.value || this.text, values ) >= 0; }); if ( !values.length ) @@ -192,7 +190,7 @@ jQuery.extend({ if (!elem || elem.nodeType == 3 || elem.nodeType == 8) return undefined; - var notxml = !elem.tagName || !jQuery.isXMLDoc( elem ), + var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ), // Whether we are setting (or getting) set = value !== undefined; @@ -200,7 +198,7 @@ jQuery.extend({ name = notxml && jQuery.props[ name ] || name; // Only do all the following if this is a node (faster for style) - if ( elem.tagName ) { + if ( elem.nodeType === 1 ) { // These attributes require special treatment var special = /href|src|style/.test( name );