Skip to content

Commit

Permalink
Fix 11547. XML and IE DOM can't be force-lowercase in removeAttr().
Browse files Browse the repository at this point in the history
See discussion on pull request: jquery#724
  • Loading branch information
Arne de Bree authored and dmethvin committed Apr 10, 2012
1 parent d7217cc commit 0e2642d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++ ) {
Expand Down
13 changes: 13 additions & 0 deletions test/unit/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -1192,3 +1192,16 @@ test("coords returns correct values in IE6/IE7, see #10828", function() {
area = map.html("<area shape='rect' href='#' alt='a' /></map>").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 = "<root><item fooBar='123' /></root>",
$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" );
});

0 comments on commit 0e2642d

Please sign in to comment.