Bug 741250 - Fix "ASSERTION: Item in list without parent". r=bz

This commit is contained in:
Mounir Lamouri 2012-04-03 17:37:15 +02:00
parent 8245e4e638
commit 7dce10b04f
3 changed files with 14 additions and 1 deletions

View File

@ -0,0 +1,9 @@
<input form="f" id="x" xmlns="http://www.w3.org/1999/xhtml">
<form id="f"></form>
<script>
window.addEventListener("load", function() {
var x = document.getElementById("x");
x.appendChild(x.cloneNode(true));
}, false);
</script>
</input>

View File

@ -34,3 +34,4 @@ load 682058.xhtml
load 682460.html
load 673853.html
load 738744.xhtml
load 741250.xhtml

View File

@ -2366,7 +2366,10 @@ nsFormControlList::AddElementToTable(nsGenericHTMLFormElement* aChild,
// the list in the hash
nsSimpleContentList *list = new nsSimpleContentList(mForm);
NS_ASSERTION(content->GetParent(), "Item in list without parent");
// If an element has a @form, we can assume it *might* be able to not have
// a parent and still be in the form.
NS_ASSERTION(content->HasAttr(kNameSpaceID_None, nsGkAtoms::form) ||
content->GetParent(), "Item in list without parent");
// Determine the ordering between the new and old element.
bool newFirst = nsContentUtils::PositionIsBefore(aChild, content);