Bug 417491 - Element.setAttribute(':', ...) throws DOMException INVALID_CHARACTER_ERR. r+sr=peterv, a=beltzner

This commit is contained in:
jwalden@mit.edu 2008-02-15 15:22:55 -08:00
Родитель 882aa5a66b
Коммит f46df7fe59
2 изменённых файлов: 5 добавлений и 9 удалений

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

@ -81,7 +81,8 @@ var allNoNSTests =
{ args: ["di<v"], code: 5 },
{ args: ["-div"], code: 5 },
{ args: [".div"], code: 5 },
{ args: [":div"], code: 5 },
{ args: [":"], message: "valid XML name, invalid QName" },
{ args: [":div"], message: "valid XML name, invalid QName" },
{ args: ["div:"], message: "valid XML name, invalid QName" },
{ args: ["d:iv"] },
{ args: ["a:b:c"], message: "valid XML name, invalid QName" },

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

@ -70,14 +70,9 @@ int MOZ_XMLCheckQName(const char* ptr, const char* end, int ns_aware,
do {
switch (BYTE_TYPE(ptr)) {
case BT_COLON:
if (nmstrt) {
/* We're at the first character and it's a colon; it's a malformed
QName if we're namespace-aware and an invalid character otherwise. */
return ns_aware ? MOZ_EXPAT_MALFORMED : MOZ_EXPAT_INVALID_CHARACTER;
}
if (ns_aware && (ptr + 2 == end || *colon)) {
/* This is the last character or a second colon when we're
namespace-aware, so the QName is malformed. */
/* We're namespace-aware and either first or last character is a colon
or we've already seen a colon. */
if (ns_aware && (nmstrt || *colon || ptr + 2 == end)) {
return MOZ_EXPAT_MALFORMED;
}
*colon = ptr;