diff options
| author | Jonathan Barronville | 2014-06-07 19:13:28 -0400 | 
|---|---|---|
| committer | Jonathan Barronville | 2014-06-07 19:13:28 -0400 | 
| commit | b56e5c671ce89f1c8ddc67a4ac8d2f59de04ea85 (patch) | |
| tree | 80ce4d67ff46505dc1ec77b72daf7bed59abf8b4 /bower_components/jquery/src/attributes/prop.js | |
| parent | 67ad58c27c4a2704532246d044e1ecbae2a11022 (diff) | |
| download | sellevate-b56e5c671ce89f1c8ddc67a4ac8d2f59de04ea85.tar.bz2 | |
Yo.
Diffstat (limited to 'bower_components/jquery/src/attributes/prop.js')
| -rw-r--r-- | bower_components/jquery/src/attributes/prop.js | 96 | 
1 files changed, 96 insertions, 0 deletions
| diff --git a/bower_components/jquery/src/attributes/prop.js b/bower_components/jquery/src/attributes/prop.js new file mode 100644 index 0000000..e2b95dc --- /dev/null +++ b/bower_components/jquery/src/attributes/prop.js @@ -0,0 +1,96 @@ +define([ +	"../core", +	"../core/access", +	"./support" +], function( jQuery, access, support ) { + +var rfocusable = /^(?:input|select|textarea|button)$/i; + +jQuery.fn.extend({ +	prop: function( name, value ) { +		return access( this, jQuery.prop, name, value, arguments.length > 1 ); +	}, + +	removeProp: function( name ) { +		return this.each(function() { +			delete this[ jQuery.propFix[ name ] || name ]; +		}); +	} +}); + +jQuery.extend({ +	propFix: { +		"for": "htmlFor", +		"class": "className" +	}, + +	prop: function( elem, name, value ) { +		var ret, hooks, notxml, +			nType = elem.nodeType; + +		// don't get/set properties on text, comment and attribute nodes +		if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { +			return; +		} + +		notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + +		if ( notxml ) { +			// Fix name and attach hooks +			name = jQuery.propFix[ name ] || name; +			hooks = jQuery.propHooks[ name ]; +		} + +		if ( value !== undefined ) { +			return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ? +				ret : +				( elem[ name ] = value ); + +		} else { +			return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ? +				ret : +				elem[ name ]; +		} +	}, + +	propHooks: { +		tabIndex: { +			get: function( elem ) { +				return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ? +					elem.tabIndex : +					-1; +			} +		} +	} +}); + +// Support: IE9+ +// Selectedness for an option in an optgroup can be inaccurate +if ( !support.optSelected ) { +	jQuery.propHooks.selected = { +		get: function( elem ) { +			var parent = elem.parentNode; +			if ( parent && parent.parentNode ) { +				parent.parentNode.selectedIndex; +			} +			return null; +		} +	}; +} + +jQuery.each([ +	"tabIndex", +	"readOnly", +	"maxLength", +	"cellSpacing", +	"cellPadding", +	"rowSpan", +	"colSpan", +	"useMap", +	"frameBorder", +	"contentEditable" +], function() { +	jQuery.propFix[ this.toLowerCase() ] = this; +}); + +}); | 
