Bug 649599 - Make getAttributeNS return null for absent attributes; r=peterv

This commit is contained in:
Ms2ger 2012-03-11 09:48:16 +01:00
parent 6dbbe95646
commit 71edcafb0e
2 changed files with 7 additions and 6 deletions

View File

@ -2853,15 +2853,16 @@ nsGenericElement::GetAttributeNS(const nsAString& aNamespaceURI,
nsContentUtils::NameSpaceManager()->GetNameSpaceID(aNamespaceURI);
if (nsid == kNameSpaceID_Unknown) {
// Unknown namespace means no attr...
aReturn.Truncate();
// Unknown namespace means no attribute.
SetDOMStringToNull(aReturn);
return NS_OK;
}
nsCOMPtr<nsIAtom> name = do_GetAtom(aLocalName);
GetAttr(nsid, name, aReturn);
bool hasAttr = GetAttr(nsid, name, aReturn);
if (!hasAttr) {
SetDOMStringToNull(aReturn);
}
return NS_OK;
}

View File

@ -105,7 +105,7 @@ function getAttributeNS03() {
assertNotNull("empAddrNotNull",testAddr);
testAddr.removeAttributeNS(namespaceURI,localName);
attrValue = testAddr.getAttributeNS(namespaceURI,localName);
assertEquals("throw_Equals","",attrValue);
assertEquals("throw_Equals",null,attrValue);
}