Open Bug 349308 Opened 16 years ago Updated 3 years ago

HTML DOM is not available in XHTML documents sent as application/xml


(Core :: DOM: Core & HTML, defect)

Not set




(Reporter: zapperlott, Unassigned)


(Depends on 1 open bug, )


(Keywords: dev-doc-needed, html5)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; de; rv: Gecko/20060806 Firefox/
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; de; rv: Gecko/20060806 Firefox/

When a (well-formed, valid and strictly conforming) XHTML document is sent with application/xml, Firefox does not provide the HTML DOM for this document.

In contrast to this, the HTML DOM is available when the document is sent as application/xhtml+xml. As far as I know, a user agent should treat XHTML documents the same, either they are sent with application/xml or application/xhtml+xml. Firefox should recognize the document as XHTML, as the root element uses the XHTML namespace (for example, like Opera does).

(Note: I'm not talking about document.write. Of course this won't be available. I'm talking about all the other HTML DOM features which are provided when the document is sent with application/xhtml+xml.)

Reproducible: Always

Steps to Reproduce:
1. Go to
2. A JavaScript will automatically output the document.body property in an alert window
Actual Results:  
An alert window pops up with »document.body: undefined«.

Expected Results:  
document.body: [object HTMLBodyElement]

As far as I can see, this hasn't been discussed explicitly. A few years ago, there was a discussion, but Hixie refused to open a bug for text/xml and application/xml, because in his opinion the HTML DOM should be limited to the specific (X)HTML MIME types text/html and application/xhtml+xml: ff.

I don't second this argumentation, I can't imagine why the HTML DOM depends on the MIME type and not the actual document. At that time, there was already the proposal to detect XHTML documents using the root element's namespace. It seems that Opera has already implemented such a detection, why does Firefox resist?

Could I at least get an official statement that the current behaviour is really intentional and won't get fixed? I haven't found bugs regarding this question.
Assignee: nobody → general
Component: General → DOM
Product: Firefox → Core
QA Contact: general → ian
Version: unspecified → 1.8 Branch
Hmm.  Maybe ask WHATWG?  Hixie might be the person who drives it, but if there's enough demand from users, changes happen.
> Firefox should recognize the document as XHTML, as the root element uses the
> XHTML namespace

That's not an invariant of the document.  As in, the namespace of the root element can change.
Assignee: general → nobody
QA Contact: ian → general
Ever confirmed: true
Keywords: html5
OS: Linux → All
Hardware: x86 → All
Version: 1.8 Branch → Trunk
Depends on: 512688
No longer depends on: 512688
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.