In IE and FF, it tells you whether you're in quirks mode: document.compatMode := "BackCompat" | "CSS1Compat"
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'.
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.
I would also like to see a test for when we are in AlmostStrict mode.
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)
(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.
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
Landed as r26096 on feature-branch.
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