Bug 1258205 - Make setAttribute throw InvalidCharacterError if the attribute already exists. r=baku

This commit is contained in:
Oriol 2016-04-15 09:01:00 -04:00
Родитель dfb2effe59
Коммит 2d08290117
2 изменённых файлов: 4 добавлений и 9 удалений

Просмотреть файл

@ -1177,14 +1177,12 @@ Element::SetAttribute(const nsAString& aName,
const nsAString& aValue, const nsAString& aValue,
ErrorResult& aError) ErrorResult& aError)
{ {
aError = nsContentUtils::CheckQName(aName, false);
if (aError.Failed()) {
return;
}
const nsAttrName* name = InternalGetExistingAttrNameFromQName(aName); const nsAttrName* name = InternalGetExistingAttrNameFromQName(aName);
if (!name) { if (!name) {
aError = nsContentUtils::CheckQName(aName, false);
if (aError.Failed()) {
return;
}
nsCOMPtr<nsIAtom> nameAtom; nsCOMPtr<nsIAtom> nameAtom;
if (IsHTMLElement() && IsInHTMLDocument()) { if (IsHTMLElement() && IsInHTMLDocument()) {
nsAutoString lower; nsAutoString lower;

Просмотреть файл

@ -6,6 +6,3 @@
[First set attribute is returned with mapped attribute set first] [First set attribute is returned with mapped attribute set first]
expected: FAIL expected: FAIL
[When qualifiedName does not match the Name production, an INVALID_CHARACTER_ERR exception is to be thrown, even if the attribute is already present. (setAttribute)]
expected: FAIL