Closed Bug 105640 Opened 23 years ago Closed 23 years ago

Expose the mode [strict/quirks] to web content

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla0.9.7

People

(Reporter: fabian, Assigned: fabian)

References

()

Details

Attachments

(1 file, 1 obsolete file)

From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4+) Gecko/20010919 BuildID: 20011019 I filed this bug after Stephan Tolksdorf's newsgroup post "Strict and standards compliant mode" of oct 17th. It links to an article (see the URL field) that claims that the best way to know whether we're in strict or quirks mode is this: var d=document.doctype strict=(d&&d.systemId)?(d.systemId.indexOf("strict")>-1)?true:(d.publicId.indexOf("transitional")>-1)?true:false:(d.publicId.indexOf("transitional")==-1)?true:false If this is true (and I believe it is), it is my opinion that we should expose the mode as a simple property of the document. IE has a property called document.compatMode. It takes two values: CSS1Compat and BackCompat (strings). Maybe we could implement that. I'm just filing this bug to make sure we take a decision instead of ignoring it. Feel free of course to mark wontfix. Reproducible: Always Steps to Reproduce: 1. Load above 2. 3. Actual Results: Blah Expected Results: Bleh
It'd be nice to provide this information to JavaScript/DOM. I'm not sure that Microsoft's property and string results make sense for Mozilla, but it may be helpful to web developers if Mozilla provides the same property. Using the same property and BackCompat result would probably be sufficient. We could return something different when in strict mode. Microsoft's documentation about compatMode is here: http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/compatmode.asp
Comment on attachment 55377 [details] [diff] [review] Proposed fix. Let me know if we want this for XML docs as well. IMHO we don't want this on XML documents. They should always be in strict mode AFAIK r=sicking
Attachment #55377 - Flags: review+
Attached patch Better fix.Splinter Review
Attachment #55377 - Attachment is obsolete: true
Attachment #55377 - Flags: review+ → needs-work+
Comment on attachment 56787 [details] [diff] [review] Better fix. sr=jst
Attachment #56787 - Flags: superreview+
-> Mozilla 0.9.7, not a feature critical for 0.9.6. Reassigning to myself, though I hope jst will check it in when the tree opens :-)
Assignee: jst → hidday
Priority: -- → P3
Hardware: PC → All
Target Milestone: --- → mozilla0.9.7
I don't think we want to return CSS1Compat. That would leave no clear way for authors to determine if the layout was IE's CSS1Compat or Gecko's CSS1Compat. I think it would be better to return "GeckoStrict". or some such.
Status: NEW → ASSIGNED
I think it's a good idea.
Determining if a script runs in IE or Gecko is something script writers do any way, I think we should be compatible with IE wrt this string so that people don't need to check for two strings if they don't need to distinguish between IE and Gecko, which they can do already anyway. The biggest reason for adding support for this property was to be compatible with IE, and if we start using different strings we're not exactly compatible wrt this property. I vote for using the patch we already have.
Marking, like, FIXED! thanks for the reviews and the checkin :-)
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
FYI: http://gemal.dk/browserspy/document.html now also shows the "compatMode" mode...
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: