5 ], function( jQuery, access, support ) {
7 var rfocusable = /^(?:input|select|textarea|button|object)$/i,
8 rclickable = /^(?:a|area)$/i;
11 prop: function( name, value ) {
12 return access( this, jQuery.prop, name, value, arguments.length > 1 );
15 removeProp: function( name ) {
16 name = jQuery.propFix[ name ] || name;
17 return this.each(function() {
18 // try/catch handles cases where IE balks (such as removing a property on window)
20 this[ name ] = undefined;
33 prop: function( elem, name, value ) {
34 var ret, hooks, notxml,
35 nType = elem.nodeType;
37 // don't get/set properties on text, comment and attribute nodes
38 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
42 notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
45 // Fix name and attach hooks
46 name = jQuery.propFix[ name ] || name;
47 hooks = jQuery.propHooks[ name ];
50 if ( value !== undefined ) {
51 return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
53 ( elem[ name ] = value );
56 return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
64 get: function( elem ) {
65 // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
66 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
67 // Use proper attribute retrieval(#12072)
68 var tabindex = jQuery.find.attr( elem, "tabindex" );
71 parseInt( tabindex, 10 ) :
72 rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
80 // Some attributes require a special call on IE
81 // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
82 if ( !support.hrefNormalized ) {
83 // href/src property should get the full normalized URL (#10299/#12915)
84 jQuery.each([ "href", "src" ], function( i, name ) {
85 jQuery.propHooks[ name ] = {
86 get: function( elem ) {
87 return elem.getAttribute( name, 4 );
93 // Support: Safari, IE9+
94 // mis-reports the default selected property of an option
95 // Accessing the parent's selectedIndex property fixes it
96 if ( !support.optSelected ) {
97 jQuery.propHooks.selected = {
98 get: function( elem ) {
99 var parent = elem.parentNode;
102 parent.selectedIndex;
104 // Make sure that it also works with optgroups, see #5701
105 if ( parent.parentNode ) {
106 parent.parentNode.selectedIndex;
126 jQuery.propFix[ this.toLowerCase() ] = this;
129 // IE6/7 call enctype encoding
130 if ( !support.enctype ) {
131 jQuery.propFix.enctype = "encoding";