aboutsummaryrefslogtreecommitdiffstats
path: root/src/attributes.js
diff options
context:
space:
mode:
authortimmywil <tim.willison@thisismedium.com>2011-06-13 10:02:13 -0400
committertimmywil <tim.willison@thisismedium.com>2011-06-13 10:02:13 -0400
commit641ad802111d2dc16ccf4b3721784a6addaf20df (patch)
treeb13af4b7a6a09388dc886f2f035e097ad6aed405 /src/attributes.js
parent39a2f29c29fdb296bb178b3c55d805ea0dc2f0ce (diff)
downloadjquery-641ad802111d2dc16ccf4b3721784a6addaf20df.tar.gz
jquery-641ad802111d2dc16ccf4b3721784a6addaf20df.zip
Attribute hooks do not need to be attached in XML docs. Fixes #9568.
Diffstat (limited to 'src/attributes.js')
-rw-r--r--src/attributes.js31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/attributes.js b/src/attributes.js
index 5b68773c9..ce7b35021 100644
--- a/src/attributes.js
+++ b/src/attributes.js
@@ -320,21 +320,23 @@ jQuery.extend({
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
// Normalize the name if needed
- name = notxml && jQuery.attrFix[ name ] || name;
+ if ( notxml ) {
+ name = jQuery.attrFix[ name ] || name;
- hooks = jQuery.attrHooks[ name ];
+ hooks = jQuery.attrHooks[ name ];
- if ( !hooks ) {
- // Use boolHook for boolean attributes
- if ( rboolean.test( name ) ) {
+ if ( !hooks ) {
+ // Use boolHook for boolean attributes
+ if ( rboolean.test( name ) ) {
- hooks = boolHook;
+ hooks = boolHook;
- // Use formHook for forms and if the name contains certain characters
- } else if ( formHook && name !== "className" &&
- (jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) {
+ // Use formHook for forms and if the name contains certain characters
+ } else if ( formHook && name !== "className" &&
+ (jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) {
- hooks = formHook;
+ hooks = formHook;
+ }
}
}
@@ -465,10 +467,11 @@ jQuery.extend({
var ret, hooks,
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
- // Try to normalize/fix the name
- name = notxml && jQuery.propFix[ name ] || name;
-
- hooks = jQuery.propHooks[ name ];
+ if ( notxml ) {
+ // Fix name and attach hooks
+ name = jQuery.propFix[ name ] || name;
+ hooks = jQuery.propHooks[ name ];
+ }
if ( value !== undefined ) {
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {