Open chriseppstein opened 7 years ago
Namespace urls are not a HTML5 thing, the glimmer only uses those interfaces to set SVG attributes during tree construction, just like HTML5. Otherwise a prefix is just treated opaque part of the attribute name.
http://w3c.github.io/html/syntax.html#creating-and-inserting-nodes
@krisselden another way of saying that is that Glimmer attempts to implement a spec-compliant HTML5 tree builder, which does not support arbitrary namespaces. If you tried to put exactly the same content in an HTML5 file, you'd see that the browser parses is the same way (without namespace-aware element and attribute creation).
@wycats but that's not what I saw when I put the exact same syntax in my browser. When I did this as a stand alone HTML file my namespaced CSS selectors matched and with glimmer they didn't. On Fri, May 12, 2017 at 9:46 AM Yehuda Katz notifications@github.com wrote:
@krisselden https://github.com/krisselden another way of saying that is that Glimmer attempts to implement a spec-compliant HTML5 tree builder, which does not support arbitrary namespaces. If you tried to put exactly the same content in an HTML5 file, you'd see that the browser parses is the same way (without namespace-aware element and attribute creation).
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/glimmerjs/glimmer-vm/issues/476#issuecomment-301127747, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAHL-NMyRxW5mdSLeBe8761-ATANjSQks5r5IzfgaJpZM4NP_K6 .
Hmmm. Maybe my test lacked the doctype. 😅
Attributes from an xml namespace are not set in that namespace. I didn't test whether elements are. But the bottom line is I think this should work:
Test Case
index.html
components/foo/template.hbs
styles/app.css
Implementation Details
I know literally nothing about the Glimmer VM, but my assumption is that it isn't using the Namespace aware DOM methods like
getAttributeNS
andsetAttributeNS
. I suspect this may be an issue for elements in a custom namespace but I haven't tested it. It may also affect mathml and svg attributes in a more general way when it comes to applying CSS to them.I also suspect that glimmer will need some config to know what namespace a prefix is in -- parsing the
index.html
doesn't seem tenable in a generic way.