RESOLVED FIXED 39887
[chromium] Add isXHTMLDocument() to Chromium's WebKit::WebDocument
https://bugs.webkit.org/show_bug.cgi?id=39887
Summary [chromium] Add isXHTMLDocument() to Chromium's WebKit::WebDocument
Aaron Boodman
Reported 2010-05-28 10:57:17 PDT
Add isXHTMLDocument() to Chromium's WebKit::WebDocument
Attachments
Patch (1.64 KB, patch)
2010-05-28 11:01 PDT, Aaron Boodman
no flags
Patch (2.56 KB, patch)
2010-05-28 12:55 PDT, Aaron Boodman
fishd: review+
fishd: commit-queue-
Aaron Boodman
Comment 1 2010-05-28 11:01:07 PDT
WebKit Review Bot
Comment 2 2010-05-28 11:54:27 PDT
Aaron Boodman
Comment 3 2010-05-28 12:34:13 PDT
Whoops. Please hold for better patch.
Aaron Boodman
Comment 4 2010-05-28 12:55:55 PDT
Darin Fisher (:fishd, Google)
Comment 5 2010-05-28 13:49:35 PDT
Comment on attachment 57364 [details] Patch WebCore/ChangeLog:5 + Added isXHTMLDocument() to WebCore::Document. nit: add bug link WebKit/chromium/ChangeLog:5 + Add isXHTMLDocument() to WebDocument. nit: add bug link
Aaron Boodman
Comment 6 2010-05-28 15:43:15 PDT
Eric Seidel (no email)
Comment 7 2010-05-28 15:44:50 PDT
Why would you want this? Don't you want to know if it's XML vs. HTML? I can't remember if there is a difference between an XHTML document and an SVG document. Then again, all of this is going to change in HTML5.
Eric Seidel (no email)
Comment 8 2010-05-28 15:46:10 PDT
WebCore currently has 3 types of documents: HTMLDocument (exposes things like document.body) Document (generic XML, no .body) SVGDocument (<svg> root, exposes a couple SVG-specific things). HTML5 has opinions on all of this. I think all interfaces are exposed on all document types in HTML5.
Aaron Boodman
Comment 9 2010-05-28 15:51:34 PDT
I want to know whether the document has things like a body node. When I debugged through it Document::isHTMLDocument() is not currently true for XHTML documents. m_xhtml is true, but m_html is false. So I added this method so that I could catch the XHTML case. Is there a better fix?
Eric Seidel (no email)
Comment 10 2010-05-28 15:57:20 PDT
Well, the real fix is HTML5. :) But I'm surprised you don't just check document.body and if that fails, check document.documentElement.firstChild. It's lame that our XHTML documents don't have a .body (even though no spec until HTML5 said they should), but the .documentElement is a pretty common workaround. Again, all of this will go away when we move to HTML5's document structure (I don't know when that will be). We should just design whatever API so that it is future compatible.
Aaron Boodman
Comment 11 2010-05-28 16:26:54 PDT
You are right, that is a better fix. I'm going to rollback this change and submit one just checking document.documentElement's node name is HTML, which is close enough to what I'm after, and more forward compatible.
Alexey Proskuryakov
Comment 12 2010-06-01 15:18:18 PDT
> It's lame that our XHTML documents don't have a .body (even though > no spec until HTML5 said they should) They do, and have done for a long time. Implemented in bug 12628.
Alexey Proskuryakov
Comment 13 2010-06-01 15:22:35 PDT
> SVGDocument (<svg> root, exposes a couple SVG-specific things). It seems that the only difference is how document.title works - as you mentioned, all documents expose all interfaces in HTML5.
Note You need to log in before you can comment on or make changes to this bug.