From: Arne de Bree Date: Mon, 2 Apr 2012 22:37:02 +0000 (+0200) Subject: Fix 11547. XML and IE DOM can't be force-lowercase in removeAttr(). X-Git-Tag: 1.8b1~211 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0e2642d2165ab61f0b141c385cb6b7becdb35401;p=jquery.git Fix 11547. XML and IE DOM can't be force-lowercase in removeAttr(). See discussion on pull request: https://github.com/jquery/jquery/pull/724 --- diff --git a/src/attributes.js b/src/attributes.js index df7ed028e..4ec364cb7 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -356,7 +356,12 @@ jQuery.extend({ i = 0; if ( value && elem.nodeType === 1 ) { - attrNames = value.toLowerCase().split( rspace ); + + if ( !jQuery.isXMLDoc( elem ) ) { + value = value.toLowerCase(); + } + + attrNames = value.split( rspace ); l = attrNames.length; for ( ; i < l; i++ ) { diff --git a/test/unit/attributes.js b/test/unit/attributes.js index dd21b6539..9fc6ac61f 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -1192,3 +1192,16 @@ test("coords returns correct values in IE6/IE7, see #10828", function() { area = map.html("a").find("area"); equal( area.attr("coords"), undefined, "did not retrieve coords correctly"); }); + +test("Handle cased attributes on XML DOM correctly in removeAttr()", function() { + expect(1); + + var xmlStr = "", + $xmlDoc = jQuery( jQuery.parseXML( xmlStr ) ), + $item = $xmlDoc.find( "item" ), + el = $item[0]; + + $item.removeAttr( "fooBar" ); + + equal( el.attributes.length, 0, "attribute with upper case did not get removed" ); +});