зеркало из https://github.com/mozilla/pjs.git
Bug 700981 part 4. Add a fast-path to IsAllowedAsChild for the case of a child that has no kids. r=smaug
This commit is contained in:
Родитель
3e93284311
Коммит
3c1d835acc
|
@ -4030,7 +4030,14 @@ bool IsAllowedAsChild(nsIContent* aNewChild, nsINode* aParent,
|
|||
"Nodes that are not documents, document fragments or "
|
||||
"elements can't be parents!");
|
||||
|
||||
if (aParent && nsContentUtils::ContentIsDescendantOf(aParent, aNewChild)) {
|
||||
// A common case is that aNewChild has no kids, in which case
|
||||
// aParent can't be a descendant of aNewChild unless they're
|
||||
// actually equal to each other. Fast-path that case, since aParent
|
||||
// could be pretty deep in the DOM tree.
|
||||
if (aParent &&
|
||||
(aNewChild == aParent ||
|
||||
(aNewChild->GetFirstChild() &&
|
||||
nsContentUtils::ContentIsDescendantOf(aParent, aNewChild)))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче