lib/abaaso.js
function ( obj, key, value ) {
		var target, result;

		if ( regex.svg.test( obj.namespaceURI ) ) {
			if ( value === undefined ) {
				result = obj.getAttributeNS( obj.namespaceURI, key );

				if ( result === null || string.isEmpty( result ) ) {
					result = undefined;
				}
				else {
					result = utility.coerce( result );
				}
			}
			else {
				obj.setAttributeNS( obj.namespaceURI, key, value );
			}
		}
		else {
			if ( typeof value === "string" ) {
				value = string.trim( value );
			}

			if ( regex.checked_disabled.test( key ) && value === undefined ) {
				return utility.coerce( obj[key] );
			}
			else if ( regex.checked_disabled.test( key ) && value !== undefined ) {
				obj[key] = value;
			}
			else if ( obj.nodeName === "SELECT" && key === "selected" && value === undefined) {
				return utility.$( "#" + obj.id + " option[selected=\"selected\"]" )[0] || utility.$( "#" + obj.id + " option" )[0];
			}
			else if ( obj.nodeName === "SELECT" && key === "selected" && value !== undefined ) {
				target = utility.$( "#" + obj.id + " option[selected=\"selected\"]" )[0];

				if ( target !== undefined ) {
					target.selected = false;
					target.removeAttribute( "selected" );
				}

				target = utility.$( "#" + obj.id + " option[value=\"" + value + "\"]" )[0];
				target.selected = true;
				target.setAttribute( "selected", "selected" );
			}
			else if ( value === undefined ) {
				result = obj.getAttribute( key );

				if ( result === null || string.isEmpty( result ) ) {
					result = undefined;
				}
				else {
					result = utility.coerce( result );
				}

				return result;
			}
			else {
				obj.setAttribute( key, value );
			}
		}

		return obj;
	}
function ( obj, key, value ) {
		var target, result;

		if ( regex.svg.test( obj.namespaceURI ) ) {
			if ( value === undefined ) {
				result = obj.getAttributeNS( obj.namespaceURI, key );

				if ( result === null || string.isEmpty( result ) ) {
					result = undefined;
				}
				else {
					result = utility.coerce( result );
				}
			}
			else {
				obj.setAttributeNS( obj.namespaceURI, key, value );
			}
		}
		else {
			if ( typeof value === "string" ) {
				value = string.trim( value );
			}

			if ( regex.checked_disabled.test( key ) && value === undefined ) {
				return utility.coerce( obj[key] );
			}
			else if ( regex.checked_disabled.test( key ) && value !== undefined ) {
				obj[key] = value;
			}
			else if ( obj.nodeName === "SELECT" && key === "selected" && value === undefined) {
				return utility.$( "#" + obj.id + " option[selected=\"selected\"]" )[0] || utility.$( "#" + obj.id + " option" )[0];
			}
			else if ( obj.nodeName === "SELECT" && key === "selected" && value !== undefined ) {
				target = utility.$( "#" + obj.id + " option[selected=\"selected\"]" )[0];

				if ( target !== undefined ) {
					target.selected = false;
					target.removeAttribute( "selected" );
				}

				target = utility.$( "#" + obj.id + " option[value=\"" + value + "\"]" )[0];
				target.selected = true;
				target.setAttribute( "selected", "selected" );
			}
			else if ( value === undefined ) {
				result = obj.getAttribute( key );

				if ( result === null || string.isEmpty( result ) ) {
					result = undefined;
				}
				else {
					result = utility.coerce( result );
				}

				return result;
			}
			else {
				obj.setAttribute( key, value );
			}
		}

		return obj;
	}
function ( obj , key , value ) { var target , result ; if ( regex . svg . test ( obj . namespaceURI ) ) { if ( value === undefined ) { result = obj . getAttributeNS ( obj . namespaceURI , key ) ; if ( result === null || string . isEmpty ( result ) ) { result = undefined ; } else { result = utility . coerce ( result ) ; } } else { obj . setAttributeNS ( obj . namespaceURI , key , value ) ; } } else { if ( typeof value === "string" ) { value = string . trim ( value ) ; } if ( regex . checked_disabled . test ( key ) && value === undefined ) { return utility . coerce ( obj [ key ] ) ; } else if ( regex . checked_disabled . test ( key ) && value !== undefined ) { obj [ key ] = value ; } else if ( obj . nodeName === "SELECT" && key === "selected" && value === undefined ) { return utility . $ ( "#" + obj . id + " option[selected=\"selected\"]" ) [ 0 ] || utility . $ ( "#" + obj . id + " option" ) [ 0 ] ; } else if ( obj . nodeName === "SELECT" && key === "selected" && value !== undefined ) { target = utility . $ ( "#" + obj . id + " option[selected=\"selected\"]" ) [ 0 ] ; if ( target !== undefined ) { target . selected = false ; target . removeAttribute ( "selected" ) ; } target = utility . $ ( "#" + obj . id + " option[value=\"" + value + "\"]" ) [ 0 ] ; target . selected = true ; target . setAttribute ( "selected" , "selected" ) ; } else if ( value === undefined ) { result = obj . getAttribute ( key ) ; if ( result === null || string . isEmpty ( result ) ) { result = undefined ; } else { result = utility . coerce ( result ) ; } return result ; } else { obj . setAttribute ( key , value ) ; } } return obj ; }
Gets or sets an Element attribute

@method attr
@param  {Mixed}  obj   Element
@param  {String} name  Attribute name
@param  {Mixed}  value Attribute value
@return {Object}       Element
Gets or sets an Element attribute