RESOLVED FIXED Bug 15062
Implement document.compatMode
https://bugs.webkit.org/show_bug.cgi?id=15062
Summary Implement document.compatMode
Geoffrey Garen
Reported 2007-08-23 11:55:19 PDT
In IE and FF, it tells you whether you're in quirks mode: document.compatMode := "BackCompat" | "CSS1Compat"
Attachments
implementation in the Document interface (6.08 KB, patch)
2007-08-28 14:05 PDT, Vincent Ricard
sam: review-
Implement compatMode (in HTMLDocument interface) (7.21 KB, patch)
2007-08-31 03:03 PDT, Vincent Ricard
mjs: review+
Vincent Ricard
Comment 1 2007-08-28 14:05:45 PDT
Created attachment 16147 [details] implementation in the Document interface here is a patch to implement document.compatMode. I used the followings links to match the FF behavior; but i'm not sure if compatMode should be declared in the Document interface or in HTMLDocument: - http://www.whatwg.org/specs/web-apps/current-work/multipage/section-documents.html - http://developer.mozilla.org/en/docs/DOM:document.compatMode So if we are in Strict mode (or AlmostStrict), we return 'CSS1Compat', otherwie we return 'BackCompat'.
Sam Weinig
Comment 2 2007-08-28 20:50:58 PDT
Comment on attachment 16147 [details] implementation in the Document interface The "{" should be on a new line. +String Document::compatMode() const { + return inCompatMode() ? "BackCompat" : "CSS1Compat"; +} I don't think there is any reason for [ConvertNullStringTo=Undefined] as null is not a possible return value. + readonly attribute [ConvertNullStringTo=Undefined] DOMString compatMode; Also, does this attribute make sense for Documents other HTML documents? If not, can we put this in the HTMLDocument? r- for now.
Sam Weinig
Comment 3 2007-08-28 20:53:21 PDT
I would also like to see a test for when we are in AlmostStrict mode.
Vincent Ricard
Comment 4 2007-08-31 03:03:50 PDT
Created attachment 16167 [details] Implement compatMode (in HTMLDocument interface) Here is the previous patch with all needed corrections (compatMode now belongs to HTMLDocument), and a new test case (now, there is one for each ParseMode)
Alexey Proskuryakov
Comment 5 2007-08-31 05:42:15 PDT
(In reply to comment #2) > Also, does this attribute make sense for Documents other HTML documents? It works for XHTML in Firefox, so it probably does with our current code organization.
Maciej Stachowiak
Comment 6 2007-09-04 04:50:17 PDT
Comment on attachment 16167 [details] Implement compatMode (in HTMLDocument interface) Implementing in HTMLDocument is ok for now - eventually we'll move all HTMLDocument stuff to be on all documents. r=me for feature-branch
Eric Seidel (no email)
Comment 7 2007-10-07 01:47:30 PDT
Landed as r26096 on feature-branch.
Alexey Proskuryakov
Comment 8 2007-10-07 02:19:37 PDT
These landed tests fail for me: fast/dom/compatMode-AlmostStrict.html -> failed . fast/dom/compatMode-Compat.html -> failed . fast/dom/compatMode-Strict.html -> failed -SUCCESS +FAILURE
Note You need to log in before you can comment on or make changes to this bug.