nexus site path corrected
[portal.git] / ecomp-portal-FE / client / bower_components / jquery / src / attributes / prop.js
1 define( [
2         "../core",
3         "../core/access",
4         "./support",
5         "../selector"
6 ], function( jQuery, access, support ) {
7
8 var rfocusable = /^(?:input|select|textarea|button)$/i,
9         rclickable = /^(?:a|area)$/i;
10
11 jQuery.fn.extend( {
12         prop: function( name, value ) {
13                 return access( this, jQuery.prop, name, value, arguments.length > 1 );
14         },
15
16         removeProp: function( name ) {
17                 return this.each( function() {
18                         delete this[ jQuery.propFix[ name ] || name ];
19                 } );
20         }
21 } );
22
23 jQuery.extend( {
24         prop: function( elem, name, value ) {
25                 var ret, hooks,
26                         nType = elem.nodeType;
27
28                 // Don't get/set properties on text, comment and attribute nodes
29                 if ( nType === 3 || nType === 8 || nType === 2 ) {
30                         return;
31                 }
32
33                 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
34
35                         // Fix name and attach hooks
36                         name = jQuery.propFix[ name ] || name;
37                         hooks = jQuery.propHooks[ name ];
38                 }
39
40                 if ( value !== undefined ) {
41                         if ( hooks && "set" in hooks &&
42                                 ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
43                                 return ret;
44                         }
45
46                         return ( elem[ name ] = value );
47                 }
48
49                 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
50                         return ret;
51                 }
52
53                 return elem[ name ];
54         },
55
56         propHooks: {
57                 tabIndex: {
58                         get: function( elem ) {
59
60                                 // elem.tabIndex doesn't always return the
61                                 // correct value when it hasn't been explicitly set
62                                 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
63                                 // Use proper attribute retrieval(#12072)
64                                 var tabindex = jQuery.find.attr( elem, "tabindex" );
65
66                                 return tabindex ?
67                                         parseInt( tabindex, 10 ) :
68                                         rfocusable.test( elem.nodeName ) ||
69                                                 rclickable.test( elem.nodeName ) && elem.href ?
70                                                         0 :
71                                                         -1;
72                         }
73                 }
74         },
75
76         propFix: {
77                 "for": "htmlFor",
78                 "class": "className"
79         }
80 } );
81
82 // Support: IE <=11 only
83 // Accessing the selectedIndex property
84 // forces the browser to respect setting selected
85 // on the option
86 // The getter ensures a default option is selected
87 // when in an optgroup
88 if ( !support.optSelected ) {
89         jQuery.propHooks.selected = {
90                 get: function( elem ) {
91                         var parent = elem.parentNode;
92                         if ( parent && parent.parentNode ) {
93                                 parent.parentNode.selectedIndex;
94                         }
95                         return null;
96                 },
97                 set: function( elem ) {
98                         var parent = elem.parentNode;
99                         if ( parent ) {
100                                 parent.selectedIndex;
101
102                                 if ( parent.parentNode ) {
103                                         parent.parentNode.selectedIndex;
104                                 }
105                         }
106                 }
107         };
108 }
109
110 jQuery.each( [
111         "tabIndex",
112         "readOnly",
113         "maxLength",
114         "cellSpacing",
115         "cellPadding",
116         "rowSpan",
117         "colSpan",
118         "useMap",
119         "frameBorder",
120         "contentEditable"
121 ], function() {
122         jQuery.propFix[ this.toLowerCase() ] = this;
123 } );
124
125 } );