aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRick Waldron <waldron.rick@gmail.com>2011-09-19 15:54:07 -0400
committertimmywil <timmywillisn@gmail.com>2011-09-19 15:54:07 -0400
commitaf1dc64bee90960f7898699c3788133177aff3bc (patch)
tree49c173eb8c5a9a440d71c482c3c8160a15a7987c
parente7a7cc8914cc1da17fd6fd14b370532d6f273069 (diff)
parentbc65f930b557b42a50f20adee4933a1ed3409f67 (diff)
downloadjquery-af1dc64bee90960f7898699c3788133177aff3bc.tar.gz
jquery-af1dc64bee90960f7898699c3788133177aff3bc.zip
Landing pull request 510. Add notes about #9699 fix.
More Details: - https://github.com/jquery/jquery/pull/510 - http://bugs.jquery.com/ticket/9699
-rw-r--r--src/attributes.js21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/attributes.js b/src/attributes.js
index 783b82d04..91b53f97e 100644
--- a/src/attributes.js
+++ b/src/attributes.js
@@ -19,11 +19,11 @@ jQuery.fn.extend({
jQuery.removeAttr( this, name );
});
},
-
+
prop: function( name, value ) {
return jQuery.access( this, name, value, true, jQuery.prop );
},
-
+
removeProp: function( name ) {
name = jQuery.propFix[ name ] || name;
return this.each(function() {
@@ -156,7 +156,7 @@ jQuery.fn.extend({
val: function( value ) {
var hooks, ret,
elem = this[0];
-
+
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
@@ -167,9 +167,9 @@ jQuery.fn.extend({
ret = elem.value;
- return typeof ret === "string" ?
+ return typeof ret === "string" ?
// handle most common string cases
- ret.replace(rreturn, "") :
+ ret.replace(rreturn, "") :
// handle cases where value is null/undef or number
ret == null ? "" : ret;
}
@@ -290,15 +290,15 @@ jQuery.extend({
height: true,
offset: true
},
-
+
attrFix: {
// Always normalize to ensure hook usage
tabindex: "tabIndex"
},
-
+
attr: function( elem, name, value, pass ) {
var nType = elem.nodeType;
-
+
// don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return undefined;
@@ -367,6 +367,7 @@ jQuery.extend({
if ( elem.nodeType === 1 ) {
name = jQuery.attrFix[ name ] || name;
+ // See #9699 for explanation of this approach (setting first, then removal)
jQuery.attr( elem, name, "" );
elem.removeAttribute( name );
@@ -431,7 +432,7 @@ jQuery.extend({
frameborder: "frameBorder",
contenteditable: "contentEditable"
},
-
+
prop: function( elem, name, value ) {
var nType = elem.nodeType;
@@ -466,7 +467,7 @@ jQuery.extend({
}
}
},
-
+
propHooks: {
tabIndex: {
get: function( elem ) {