3 ms·
> XUL is a specific XML namespace (like HTML or SVG) Er, HTML is not an XML namespace, it's a SGML implementation. W3C tried to retrofit it on XML with XHTML b
by toyg 4y ago
> XUL is a specific XML namespace (like HTML or SVG)
Er, HTML is not an XML namespace, it's a SGML implementation. W3C tried to retrofit it on XML with XHTML but that was then abandoned. Modern HTML is not XML-compliant in various ways.
I expect this kind of casual lie from the average developer, not from the guy working on XUL at Mozilla.
/Pedantry
- notpushkin 4y agoXHTML still works by the way, all HTML5 goodness included. I tend to write sites in XHTML myself as default HTML parsing feels broken in many subtle ways.
- mort96 4y agoHeh, I wouldn't even know which URLs to put in the doctype for XHTML. I certainly won't ever memorize it. As long as HTML is `<!DOCTYPE html>` and XHTML is `<!DOCTYPE some ridiculously long string with a bunch of URLs and crap>` I don't think I'll be using XHTML. It's also pretty risky to let any slight syntax error or semantic error cause the whole page to refuse to load. That would turn me off from targeting XHTML for any kind of dynamic page generation, not because I want to generate incorrect HTML or XHTML or whatever, but because bugs happen.
- notpushkin 4y agoXHTML works fine even without a doctype actually (or with a <!DOCTYPE html>). The stricter syntax is a double-edged sword though, I agree.
- mort96 4y agoWon't the browser just interpret that as an HTML document then?
- notpushkin 4y agoNope. The thing that browser looks for is the Content-Type header – if it's set to application/xhtml+xml, it will parse the document as XHTML. For static sites, just setting extension to .xhtml is usually enough.
- mogoh 4y agoWell, you still can write XML compliant modern HTML. Just don't forget to serve it with HTTP header: `Content-Type: application/xhtml+xml; charset=utf-8`. The browser will treat it as XML. But that is not true for all HTML, of course. So you are kind of right.
- gsnedders 4y agoModern HTML, per the HTML spec, has implicit namespaces: if you look at the DOM on any site, you'll find the root element of any HTML page is an element in the "http://www.w3.org/1999/xhtml http://www.w3.org/1999/xhtml" XML namespace (c.f. `document.documentElement.namespaceURI`). It was _absolutely deliberate_ that the DOM produced by parsing HTML and XHTML is now the same in overall structure, with the same XML namespaces, as it means browsers don't need to have things like `if localName == "html" and (namespaceURI == "http://www.w3.org/1999/xhtml http://www.w3.org/1999/xhtml" or isHTMLDocument)` all over the place. Modern WHATWG specs put a lot of effort into reducing the number of places where the behaviour of a given DOM depends on whether the document is an HTML document—and most of those are places where non-namespace aware APIs default to the "http://www.w3.org/1999/xhtml http://www.w3.org/1999/xhtml" namespace in HTML documents.