html template tag does not work on a XUL page
Categories
(Core :: XUL, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox68 | --- | fixed |
People
(Reporter: evold, Assigned: bdahl)
References
Details
Attachments
(2 files)
|
2.62 KB,
patch
|
Details | Diff | Splinter Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review |
I was working on bug 1079434 and ran into this. You can use the diff I created there, I expected it to just work, but it is failing on the `let inputs = template.content.querySelectorAll("input");` bit, returning a length of 0 and I expect a length of 2.
| Reporter | ||
Comment 1•7 years ago
|
||
Updated•7 years ago
|
Comment 2•7 years ago
|
||
The magic support for putting things in the .content instead of the actual DOM is part of the HTML parsing algorithm. This document is not being parsed with the HTML parser, but with the XUL parser, so you don't get the magic. It looks like we hacked nsXMLContentSink to make this work (per the "willful violation of the XML specification" note in HTML), but not the XUL content sink.
Comment 3•7 years ago
|
||
Unfortunately, the XUL content sink uses nsXULPrototypeNode as its "current parent" abstraction, which makes things here ... complicated. In particular, presumably supporting this needs changes to prototype instantiation, not just the parser.
Yeah, I don't think making this work is worth it.
Comment 5•3 years ago
|
||
This issue has surfaced in multiple forms lately as we are trying to reduce our dependency on XUL/XBL. Two cases are: 1) The move from DTD/.properties to Fluent involved use of DOM Overlays which use <template> tag to merge and sanitize DOM Fragments for localization. That works great for HTML, but unfortunately lack of <template> tag in XUL makes it not able to handle XUL. We currently inject HTML elements into XUL for that (<a> and <img> etc.) but that's suboptimal. It would be make the Fluent transition easier and less likely to regress if we could use <template> tag in XUL 2) The XUL Overlay removal also would benefit from ability to use <teplate> tag in XUL ( NI on :bdhal for more detail). Is there any chance this became less complex to do over the last three years bz?
Comment 6•3 years ago
|
||
Nothing about the parsing end of this has changed.
| Assignee | ||
Comment 7•3 years ago
|
||
(In reply to Zibi Braniecki [:gandalf][:zibi] from comment #5) > 2) The XUL Overlay removal also would benefit from ability to use <teplate> > tag in XUL ( NI on :bdhal for more detail). I was considering using a template so I could create the downloads panel lazily (see bug 1434077). However, using a hidden="true" for panel appears to be enough to not cause performance issues.
Comment 8•2 years ago
|
||
I would need this too for bug 1520350 and I ended up hack my way out with CDATA ... I guess this will be supported automagically when we convert the XUL files to XHTML?
Comment 9•2 years ago
|
||
(In reply to Tim Guan-tin Chien [:timdream] (please needinfo; no longer work for MoCo) from comment #8)
I would need this too for bug 1520350 and I ended up hack my way out with CDATA ... I guess this will be supported automagically when we convert the XUL files to XHTML?
I don't think it will, at least not for XHTML docs created via the prototype cache (as added in Bug 1527977).
Perhaps PrototypeDocumentContentSink would give us a better starting point for adding support (dealing with stuff like Comment 3). I'm not sure, but it's quite likely we'll want something like this for lazifying markup for the remaining XBL bindings (see discussion in https://phabricator.services.mozilla.com/D24914#729312). Going to needinfo Brendan for when he gets back to see if we have any new options here.
| Assignee | ||
Comment 10•2 years ago
|
||
With XHTML the first parse and creation of the prototype document still is done with an XML parser and XUL content sink, so nothing has really changed here.
| Assignee | ||
Updated•2 years ago
|
| Assignee | ||
Comment 11•2 years ago
|
||
Check if the current parent element is an HTML template element and if it
is, append to the document fragment instead of it.
Comment 12•2 years ago
|
||
Pushed by bdahl@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8235d59e1d86 Support HTML template in XUL documents. r=smaug
Comment 13•2 years ago
|
||
| bugherder | ||
Description
•