Open Bug 297290 Opened 19 years ago Updated 2 years ago

Handling of <template>s in nsXULContentBuilder::RemoveGeneratedContent seems suboptimal

Categories

(Core :: XUL, defect)

defect

Tracking

()

People

(Reporter: sicking, Unassigned)

Details

There is a shortcut in nsXULContentBuilder::RemoveGeneratedContent that
shortcuts a loop we're looping the children of a <template> with a comment like
this:

            // Optimize for the <template> element, because we *know*
            // it won't have any generated content: there's no reason
            // to even check this subtree.

However it looks like that shortcut should be moved outside the loop so that we
skip it entierly instead. Or do we want to make sure we call GetChildAt() to
ensure that all generated children gets generated first? If so a simple call to
GetChildCount should be enough, no need to loop through all children.

But i'm not sure if we're actually intending to look at the child rather then
the element? That seems to make more sense.

CCing some people that might know how this code is supposed to work
Actually RemoveGeneratedContent loops over the children of the parent of the
<template>, so there should always be a template in there. I think this bug is
invalid.

Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: xptoolkit.xul → xptoolkit.widgets
Neil, I don't understand comment 1.  No problem with there being a <template> in the list of things we're looping over, but the check is on the _parent_ of the things we're looping over.  Or the parent of the <template>, per comment 1.  Why is the bug invalid, exactly?
OK, yes it should be looking at the child instead.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.