Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'libs/bower_components/jquery/src/attributes/prop.js')
-rw-r--r--libs/bower_components/jquery/src/attributes/prop.js98
1 files changed, 60 insertions, 38 deletions
diff --git a/libs/bower_components/jquery/src/attributes/prop.js b/libs/bower_components/jquery/src/attributes/prop.js
index 817a1b6211..1c3a0f9718 100644
--- a/libs/bower_components/jquery/src/attributes/prop.js
+++ b/libs/bower_components/jquery/src/attributes/prop.js
@@ -1,98 +1,110 @@
-define([
+define( [
"../core",
"../core/access",
- "./support"
+ "./support",
+ "../selector"
], function( jQuery, access, support ) {
var rfocusable = /^(?:input|select|textarea|button|object)$/i,
rclickable = /^(?:a|area)$/i;
-jQuery.fn.extend({
+jQuery.fn.extend( {
prop: function( name, value ) {
return access( this, jQuery.prop, name, value, arguments.length > 1 );
},
removeProp: function( name ) {
name = jQuery.propFix[ name ] || name;
- return this.each(function() {
+ return this.each( function() {
+
// try/catch handles cases where IE balks (such as removing a property on window)
try {
this[ name ] = undefined;
delete this[ name ];
- } catch( e ) {}
- });
+ } catch ( e ) {}
+ } );
}
-});
-
-jQuery.extend({
- propFix: {
- "for": "htmlFor",
- "class": "className"
- },
+} );
+jQuery.extend( {
prop: function( elem, name, value ) {
- var ret, hooks, notxml,
+ var ret, hooks,
nType = elem.nodeType;
- // don't get/set properties on text, comment and attribute nodes
- if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+ // Don't get/set properties on text, comment and attribute nodes
+ if ( nType === 3 || nType === 8 || nType === 2 ) {
return;
}
- notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
+ if ( 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 ];
+ if ( hooks && "set" in hooks &&
+ ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
+ return ret;
+ }
+
+ return ( elem[ name ] = value );
+ }
+
+ if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
+ return ret;
}
+
+ return elem[ name ];
},
propHooks: {
tabIndex: {
get: function( elem ) {
- // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
+
+ // elem.tabIndex doesn't always return the
+ // correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
// Use proper attribute retrieval(#12072)
var tabindex = jQuery.find.attr( elem, "tabindex" );
return tabindex ?
parseInt( tabindex, 10 ) :
- rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
- 0 :
- -1;
+ rfocusable.test( elem.nodeName ) ||
+ rclickable.test( elem.nodeName ) && elem.href ?
+ 0 :
+ -1;
}
}
+ },
+
+ propFix: {
+ "for": "htmlFor",
+ "class": "className"
}
-});
+} );
// Some attributes require a special call on IE
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !support.hrefNormalized ) {
+
// href/src property should get the full normalized URL (#10299/#12915)
- jQuery.each([ "href", "src" ], function( i, name ) {
+ jQuery.each( [ "href", "src" ], function( i, name ) {
jQuery.propHooks[ name ] = {
get: function( elem ) {
return elem.getAttribute( name, 4 );
}
};
- });
+ } );
}
// Support: Safari, IE9+
-// mis-reports the default selected property of an option
-// Accessing the parent's selectedIndex property fixes it
+// Accessing the selectedIndex property
+// forces the browser to respect setting selected
+// on the option
+// The getter ensures a default option is selected
+// when in an optgroup
if ( !support.optSelected ) {
jQuery.propHooks.selected = {
get: function( elem ) {
@@ -107,11 +119,21 @@ if ( !support.optSelected ) {
}
}
return null;
+ },
+ set: function( elem ) {
+ var parent = elem.parentNode;
+ if ( parent ) {
+ parent.selectedIndex;
+
+ if ( parent.parentNode ) {
+ parent.parentNode.selectedIndex;
+ }
+ }
}
};
}
-jQuery.each([
+jQuery.each( [
"tabIndex",
"readOnly",
"maxLength",
@@ -124,11 +146,11 @@ jQuery.each([
"contentEditable"
], function() {
jQuery.propFix[ this.toLowerCase() ] = this;
-});
+} );
// IE6/7 call enctype encoding
if ( !support.enctype ) {
jQuery.propFix.enctype = "encoding";
}
-});
+} );