Closed Bug 270567 Opened 21 years ago Closed 12 years ago

no parent chain for anonymous content causes anonymous <option> to fail

Categories

(Core Graveyard :: XTF, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: bryner, Assigned: alex)

Details

I tried creating an XTF element which has as its anonymous child an HTML <option> element, and inserting this element inside an HTML select. This fails to work because nsHTMLOptionElement tries to walk up the content tree to find its select. When it gets to the root of the anonymous content, it can't go any further and fails. This is a rather complicated problem because there are non-trivial implications to hooking up the parent pointer on the root anonymous content. Events can start bubbling out, so you either have to stop them or perform some kind of event retargeting like XBL does. Another option would be to add a different method on nsIContent that's like GetParent() but will reach across the anonymous content boundary. It could be used in cases like this where an element needs to find a parent element that it's expected to be contained in. This doesn't help the event situation, we'd have to deal with that separately. I'm undecided on which approach I like better; hyatt notes that in sXBL, the parent element linkage was removed. It's definitely lower-risk to make all interaction with the anonymous content tree explicit. If we do decide we want the parent linkage to work like XBL, I'd like to seriously look at sharing this mechanism with XBL so we're not duplicating it... basically enabling the binding manager to handle both XBL and XTF bindings. What do you guys think?
adding a few more people
Blocks: 270572
In sXBL we also have a separate interface for going up the parent chains (and for doing so in various different ways): http://www.w3.org/TR/sXBL/#the-nodexbl A similar mechanism might be relevant here, with HTML form elements all being changed so that they crawl up appropriately. However, you have to be careful. You don't want the anonymous <html:select> inside an <xforms:select> appearing in an <html:form> ancestor. There needs to be a way for the <xforms:select> to say "this is the root of your subtree" to the <html:select> and <html:option>s, etc.
No longer blocks: 270572
> When it gets to the root of the anonymous content, it can't go any further and > fails. Hmm... Why is this? The parent pointer for anonymous content should be set, no? It was last I checked. See http://lxr.mozilla.org/seamonkey/source/layout/html/style/src/nsCSSFrameConstructor.cpp#5429 > Events can start bubbling out, so you either have to stop them or perform some > kind of event retargeting like XBL does. We already perform event retargeting for native anonymous content. See http://lxr.mozilla.org/seamonkey/source/content/base/src/nsGenericElement.cpp#1867 Otherwise form controls would screw up events quite badly.. (well, more than they do now).
Note that hixie's point about anonymous form controls in non-anonymous forms is well-taken. We'd have to watch out for that... I bet we get it wrong right now.
Assignee: bryner → alex
QA Contact: xtf
XTF has been removed from the tree. [xtfisdead] for filtering purposes.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.