Barra de pesquisas do Google

Google

sábado, 1 de novembro de 2014

How Quirks mode works

A document is always set to one of three modes: 
  1. no-quirks mode, the default; 
  2. quirks mode, used typically for legacy documents; 
  3. limited-quirks mode. 
Unless stated otherwise, a document must be in no-quirks mode.

The mode is only ever changed from the default if the document is created by the HTML parser, based on the presence, absence, or value of the DOCTYPE string. [HTML]

No-quirks mode was originally known as "standards mode" and limited-quirks mode was once known as "almost standards mode". They have been renamed because their details are now defined by standards. (And because Ian Hickson vetoed their original names on the basis that they are nonsensical.)




Quirks Mode
In the Quirks mode, browsers violate contemporary Web format specifications in order to avoid “breaking” pages authored according to practices that were prevalent in the late 1990s.

Standards Mode
In the Standards mode, browsers try to give conforming documents the specification-wise correct treatment to the extent implemented in a particular browser. HTML5 calls this mode the “no quirks mode.”

Almost Standards Mode
Firefox, Safari, Chrome, Opera (since 7.5) and IE8 also have a mode known as “Almost Standards mode,” that implements the vertical sizing of table cells traditionally and not rigorously according to the CSS2 specification. HTML5 calls this mode the “limited quirks mode.”

Possible Impacts:
There are several effects that most browsers use in Quirks Mode:
  • In some browsers, the box model changes to the IE 5.5 version of the box model in quirks mode.
  • Some browsers don't inherit styles into tables
  • Quirks mode affects the parsing of CSS and CSS layout dramatically, if you are converting pages to standards mode from quirks mode, be sure to test your CSS layout and parsing extensively.
  • Watch for changes to scripting when in quirks mode. Firefox changes the way the id-attribute works, for example. IE8 and IE9 have very dramatic changes to scripting in quirks mode.

These information are the result of a study I made while working in a legacy product, to understand the behavior why the browser was running under quirks/compatibility mode and find the best solution, considering possible impacts... I strongly recommend to use the latest doctype declaration (i.e. for HTML5) and replace deprecated CSS styles for the html5 equivalent ones).

References:

Nenhum comentário:

Sign by Dealighted - Coupons & Discount Shopping