Bug 856140 - Sync our document.registerElement implementation to the current version of the spec. r=mrbkap

This commit is contained in:
William Chen
2014-02-23 13:01:26 -08:00
parent c7b77b6eb3
commit a18f868583
31 changed files with 2010 additions and 232 deletions

View File

@@ -435,6 +435,9 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
// local name is never null
nsCOMPtr<nsIAtom> localName =
Reget(attributes->getLocalNameNoBoundsCheck(i));
nsCOMPtr<nsIAtom> prefix = attributes->getPrefixNoBoundsCheck(i);
int32_t nsuri = attributes->getURINoBoundsCheck(i);
if (ns == kNameSpaceID_XHTML &&
nsHtml5Atoms::a == name &&
nsHtml5Atoms::name == localName) {
@@ -442,17 +445,30 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
// Remove when fixing bug 582361
NS_ConvertUTF16toUTF8 cname(*(attributes->getValueNoBoundsCheck(i)));
NS_ConvertUTF8toUTF16 uv(nsUnescape(cname.BeginWriting()));
newContent->SetAttr(attributes->getURINoBoundsCheck(i),
newContent->SetAttr(nsuri,
localName,
attributes->getPrefixNoBoundsCheck(i),
prefix,
uv,
false);
} else {
newContent->SetAttr(attributes->getURINoBoundsCheck(i),
nsString& value = *(attributes->getValueNoBoundsCheck(i));
newContent->SetAttr(nsuri,
localName,
attributes->getPrefixNoBoundsCheck(i),
*(attributes->getValueNoBoundsCheck(i)),
prefix,
value,
false);
// Custom element prototype swizzling may be needed if there is an
// "is" attribute.
if (kNameSpaceID_None == nsuri && !prefix && nsGkAtoms::is == localName) {
ErrorResult errorResult;
newContent->OwnerDoc()->SwizzleCustomElement(newContent,
value,
newContent->GetNameSpaceID(),
errorResult);
}
}
}