don't set attributes that are already set

git-svn-id: svn://10.0.0.236/trunk@10657 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
peterl%netscape.com
1998-09-22 02:09:26 +00:00
parent db24360778
commit 1de0d0e996
2 changed files with 24 additions and 14 deletions

View File

@@ -423,8 +423,6 @@ AddAttributes(const nsIParserNode& aNode,
nsIHTMLContent* aContent,
nsIScriptContextOwner* aScriptContextOwner)
{
nsIContent* content = (nsIContent*) aContent;
// Add tag attributes to the content attributes
nsAutoString k, v;
PRInt32 ac = aNode.GetAttributeCount();
@@ -434,12 +432,19 @@ AddAttributes(const nsIParserNode& aNode,
k.Truncate();
k.Append(key);
k.ToUpperCase();
// Get value and remove mandatory quotes
GetAttributeValueAt(aNode, i, v, aScriptContextOwner);
// Add attribute to content
content->SetAttribute(k, v, PR_FALSE);
nsIAtom* keyAtom = NS_NewAtom(k);
nsHTMLValue value;
if (NS_CONTENT_ATTR_NOT_THERE ==
aContent->GetAttribute(keyAtom, value)) {
// Get value and remove mandatory quotes
GetAttributeValueAt(aNode, i, v, aScriptContextOwner);
// Add attribute to content
aContent->SetAttribute(keyAtom, v, PR_FALSE);
}
NS_RELEASE(keyAtom);
}
return NS_OK;
}