Attribute hooks do not need to be attached in XML docs. Fixes #9568.
This commit is contained in:
parent
39a2f29c29
commit
641ad80211
3 changed files with 22 additions and 18 deletions
|
@ -320,21 +320,23 @@ jQuery.extend({
|
||||||
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
|
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
|
||||||
|
|
||||||
// Normalize the name if needed
|
// 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 ) {
|
if ( !hooks ) {
|
||||||
// Use boolHook for boolean attributes
|
// Use boolHook for boolean attributes
|
||||||
if ( rboolean.test( name ) ) {
|
if ( rboolean.test( name ) ) {
|
||||||
|
|
||||||
hooks = boolHook;
|
hooks = boolHook;
|
||||||
|
|
||||||
// Use formHook for forms and if the name contains certain characters
|
// Use formHook for forms and if the name contains certain characters
|
||||||
} else if ( formHook && name !== "className" &&
|
} else if ( formHook && name !== "className" &&
|
||||||
(jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) {
|
(jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) {
|
||||||
|
|
||||||
hooks = formHook;
|
hooks = formHook;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,10 +467,11 @@ jQuery.extend({
|
||||||
var ret, hooks,
|
var ret, hooks,
|
||||||
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
|
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
|
||||||
|
|
||||||
// Try to normalize/fix the name
|
if ( notxml ) {
|
||||||
name = notxml && jQuery.propFix[ name ] || name;
|
// Fix name and attach hooks
|
||||||
|
name = jQuery.propFix[ name ] || name;
|
||||||
hooks = jQuery.propHooks[ name ];
|
hooks = jQuery.propHooks[ name ];
|
||||||
|
}
|
||||||
|
|
||||||
if ( value !== undefined ) {
|
if ( value !== undefined ) {
|
||||||
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
|
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<dashboard>
|
<dashboard>
|
||||||
<locations class="foo">
|
<locations class="foo">
|
||||||
<location for="bar">
|
<location for="bar" checked="different">
|
||||||
<infowindowtab>
|
<infowindowtab>
|
||||||
<tab title="Location"><![CDATA[blabla]]></tab>
|
<tab title="Location"><![CDATA[blabla]]></tab>
|
||||||
<tab title="Users"><![CDATA[blublu]]></tab>
|
<tab title="Users"><![CDATA[blublu]]></tab>
|
||||||
|
|
|
@ -132,11 +132,12 @@ test("attr(String)", function() {
|
||||||
|
|
||||||
if ( !isLocal ) {
|
if ( !isLocal ) {
|
||||||
test("attr(String) in XML Files", function() {
|
test("attr(String) in XML Files", function() {
|
||||||
expect(2);
|
expect(3);
|
||||||
stop();
|
stop();
|
||||||
jQuery.get("data/dashboard.xml", function( xml ) {
|
jQuery.get("data/dashboard.xml", function( xml ) {
|
||||||
equals( jQuery( "locations", xml ).attr("class"), "foo", "Check class attribute in XML document" );
|
equal( jQuery( "locations", xml ).attr("class"), "foo", "Check class attribute in XML document" );
|
||||||
equals( jQuery( "location", xml ).attr("for"), "bar", "Check for attribute in XML document" );
|
equal( jQuery( "location", xml ).attr("for"), "bar", "Check for attribute in XML document" );
|
||||||
|
equal( jQuery( "location", xml ).attr("checked"), "different", "Check that hooks are not attached in XML document" );
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue