Question

Suppose that you have a page that renders in browser's standard rendering mode. Suppose that there is a button on the page that, when clicked, downloads a set of external CSS and JavaScript files and creates some DOM elements.

Is it possible that after the button is pressed and new CSS and JavaScript is downloaded and new DOM created, that the rendering mode for the page changes from standard to quirks?

Was it helpful?

Solution

Short answer: I have no idea.

Long answer: You might be able to take advantage of browser-specific "features" and convince the browser to change from standards to quirks, but it would likely involve some nasty hacks and unmaintainable coding practices. The W3C has an interface called DOMImplementation (link to specification) that adds some document-level functions to DOM2, but as far as how effective they are I can't say.

However, the key point of this answer is that you should question exactly why you need quirks mode in the first place. Ideally, you should create your new DOM elements to be compatible with standards mode and avoid the whole mess altogether. Considering that quirks mode can vary greatly between browsers, your best bet is to target the standard and handle inconsistencies on a case-by-case basis.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top