зеркало из https://github.com/mozilla/gecko-dev.git
bug 123118, insert overlay elements with no id into the root of the target document.
sr=brendan, r=jst
This commit is contained in:
Родитель
775ea0867d
Коммит
f595b2475a
|
@ -6303,12 +6303,6 @@ nsXULDocument::CreateOverlayElement(nsXULPrototypeElement* aPrototype, nsIConten
|
|||
nsCOMPtr<nsIContent> element;
|
||||
rv = nsXULElement::Create(aPrototype, this, PR_FALSE, getter_AddRefs(element));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (aPrototype->mNodeInfo->Equals(nsHTMLAtoms::script, kNameSpaceID_XUL) ||
|
||||
aPrototype->mNodeInfo->Equals(nsHTMLAtoms::script, kNameSpaceID_HTML)) {
|
||||
// <script> tags in an overlay don't need a forward reference.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
OverlayForwardReference* fwdref = new OverlayForwardReference(this, element);
|
||||
if (! fwdref)
|
||||
|
@ -6531,6 +6525,13 @@ nsXULDocument::OverlayForwardReference::Resolve()
|
|||
rv = mOverlay->GetAttr(kNameSpaceID_None, nsXULAtoms::id, id);
|
||||
if (NS_FAILED(rv)) return eResolve_Error;
|
||||
|
||||
if (id.IsEmpty()) {
|
||||
// overlay had no id, use the root element
|
||||
mDocument->InsertElement(mDocument->mRootContent, mOverlay);
|
||||
mResolved = PR_TRUE;
|
||||
return eResolve_Succeeded;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMElement> domtarget;
|
||||
rv = mDocument->GetElementById(id, getter_AddRefs(domtarget));
|
||||
if (NS_FAILED(rv)) return eResolve_Error;
|
||||
|
|
Загрузка…
Ссылка в новой задаче