From ca3d2ed9ce1c270ea77a25fb231a0046997d837f Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Sun, 24 Oct 2004 17:18:27 +0000 Subject: [PATCH] Make setting attributes via attribute nodes in HTML correctly lowercase the attr name. Bug 264644, r=sicking, sr=peterv git-svn-id: svn://10.0.0.236/trunk@164275 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/src/nsDOMAttributeMap.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/mozilla/content/base/src/nsDOMAttributeMap.cpp b/mozilla/content/base/src/nsDOMAttributeMap.cpp index 79dbe744b48..de31feb311b 100644 --- a/mozilla/content/base/src/nsDOMAttributeMap.cpp +++ b/mozilla/content/base/src/nsDOMAttributeMap.cpp @@ -170,8 +170,18 @@ nsDOMAttributeMap::SetNamedItem(nsIDOMNode *aNode, nsIDOMNode **aReturn) // Set the new attributevalue attribute->GetValue(value); - rv = mContent->SetAttr(ni->NamespaceID(), ni->NameAtom(), - ni->GetPrefixAtom(), value, PR_TRUE); + if (ni->NamespaceID() == kNameSpaceID_None && + mContent->IsContentOfType(nsIContent::eHTML)) { + // Set via setAttribute(), which may do normalization on the + // attribute name for HTML + nsCOMPtr ourElement(do_QueryInterface(mContent)); + NS_ASSERTION(ourElement, "HTML content that's not an element?"); + ourElement->SetAttribute(name, value); + } else { + // It's OK to just use SetAttr + rv = mContent->SetAttr(ni->NamespaceID(), ni->NameAtom(), + ni->GetPrefixAtom(), value, PR_TRUE); + } // Not all attributes implement nsIAttribute. nsCOMPtr attr = do_QueryInterface(aNode);