List of everything that doesn't work correctly in quirks mode? [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question 开发者_开发知识库Does anyone have a complete list of HTML, JavaScript, and CSS that is buggy in Quirks Mode (particularly IE Quirks Mode)?
I have checked out the quirksmode.org list at http://www.quirksmode.org/css/quirksmode.html, but it does not seem to be comprehensive. For example, I've seen some browsers have problems with frames unless you use a frameset doctype.
Thanks, b.a.a.
Here is an aggregate of browser specific quirks mode behaviors:
Some HTML5 features are not supported some versions of IE. E.g., IE 9 does not recognize the canvas element in Quirks Mode.
The box model is incorrect (different from CSS specifications, though perhaps intuitively more natural). This means that the width and height properties specify the dimensions of the entire element box, including padding and border, and not just the element’s content. (There is a demo later in this document.)
Dimensions of non-replaced inline elements (e.g., span elements by default) are affected by width and height properties (while by CSS specifications, they shall be ignored).
Percentage heights for elements (e.g.,
<table height="100%">
in HTML ortable { height: 100% }
in CSS) are applied, using the available height as reference, even when the enclosing block has height: auto (the default). In Standards Mode, the height is determined by the requirements of the content; but percentage heights work when the enclosing block has its height set to a specific value.The height of the body element is 100%, as opposite to being determined by its content. (If you want 100% height for body in standards mode, set
html, body { height: 100% }
in CSS.)Textarea widths are calculated differently. E.g., on IE 9, cols=5 makes the area 5 characters wide in Standards Mode but only 4 characters wide in Quirks Mode.
Overflow is treated by expanding a box. When the content of an element does not fit into the dimensions specified for it (explicitly or implicitly), then overflow: visible (the default) means that the content overflows while the box dimensions are as specified. In Quirks Mode, the dimensions change; this can easily been seen e.g. if the box has a background color or a border.
Alt text is not always shown as a replacement for an image when the image is not shown. When the img element has dimensions smaller than needed for the text, e.g. as in
<img src="x.png" alt="Some alt text" width="8" height="9">
when x.png does not exist. Firefox omits the text and shows a generic icon for a broken image only.The root element is the body element on IE in Quirks Mode. By the specifications, it is the html element. For example, setting a margin or width for body has no effect in Quirks Mode. As another example, IE has a vertical scrollbar by default, though it is inactive (dim) when there is nothing to scroll, and you can remove it (when it is not needed) in Quirks Mode by setting
body { overflow: auto; }
, but in Standards Mode, you need to addhtml { overflow: auto; }
as well.A gray 2px page border appears by default on some versions of IE. It can in some cases be changed or removed by setting the border property of the html element (e.g.,
html { border: 0; }
).The id attribute values are matched case-insensitively, so that e.g. the CSS selector #foo matches an element with id="Foo". By the specifications, the match must be case-sensitive: #foo matches only an element with id="foo".
Padding for an image is ignored when set in CSS for an img element or an input type="image" element. Default horizontal margin for a floated image is three pixels (instead of zero). That is, if the img element has the attribute align="left" or align="right" or if the CSS rule float: left or float: right applies to it, the browser behaves as if the img element had the attribute hspace="3" (or its margin-left and margin-right properties had the value 3px). This applies to IE; on other browsers, Quirks Mode may cause the extra margin on one side of the image only, and its width can be 2 pixels instead of 3.
Vertical alignment of an image is under certain conditions to the bottom of the enclosing box, not to the baseline of text. This happens when the image is the only content within an element, typically a table cell. This means that e.g. an image in a table cell is by default at the bottom of the cell in Quirks Mode (which is often what the author wants), whereas in Standards Mode there is a few pixels spacing below the image (unless one sets e.g. vertical-align: bottom for the img element).
Text rendering on IE 9 does not use several new features in the browser, when in Quirks Mode. This may e.g. make the width needed by some text different in different modes, thereby affecting the division of text into lines. See Microsoft’s About Text Rendering in Windows Internet Explorer 9.
Centering a block in CSS using e.g. margin: 0 auto does not work. Note: On IE up to IE 7, setting align="center" in HTML or text-align: center in CSS for a div incorrectly centers any inner block element as a whole, even in Standards Mode. On IE 8, this happens in Quirks Mode only,
Font properties are not inherited from body or other enclosing elements into tables. This happens especially for font-size but may happen for font face, color, and line height as well. For example, if you set
body { font-family: Arial }
, it is possible that the font in table cells remains the browser default.In a font size setting for a table cell, a percentage value is interpreted as relative to the browser’s basic font size, not to the font size that applies to the enclosing element (the table row) by CSS specifications.
Font size keywords are interpreted incorrectly so that medium is larger than the browser’s basic font size and small equals that basic font size. Similarly, the entire scale of keywords, xx-small, x-small, small, large, x-large, xx-large is interpreted systematically wrong: each value is interpreted as one step larger than it should.
Font rendering is different on IE 9. In Standards Mode, it applies more advanced technologies. This causes small difference that may matter, affecting the width of text among other things. See About Text Rendering in Windows Internet Explorer 9.
Border width keywords thin, medium, and thick have different meanings on IE. For example, thin is 1px in Standards Mode, 2px in Quirks Mode.
The bordercolor attribute, which is nonstandard but widely supported, is treated differently in Quirks Mode vs. Standards mode by IE. The colors appear differently, though this seems to be caused by an effect on border style.
Radio buttons and checkboxes have total dimensions 20 by 20 pixels in IE in Quirks Mode, as opposite to 13 by 13 in Standards Mode and in other browsers. The size of the graphic button or box is the same, but the spacing around it is different. It is an integral part of the element rendering, not affected by padding or margin properties, but affected by width and height properties.
Malformed property values are often interpreted on the basis of guesswork, e.g. margin: 10 as margin: 10px and color: ffffff as color: #ffffff. This violates mandatory error processing rules in CSS: a rule using syntactically incorrect value shall be ignored.
Incorrect property values that are not recognized by a browser may cause an earlier setting for the property to be ignored. For example, setting
h1 { color: red; color: nonsense; }
may cause the entire rule to be ignored; by the specifications, the correct settingcolor: red
shall prevail. Such duplicate settings are often used in an attempt to provide a fallback when using advanced CSS values, and this often fails in Quirks Mode, because the fallback gets ignored. The problem only appears within a CSS rule, so dividing a rule into two parts would help. For example, instead ofh1 { color: #ccc; color: rgba(255, 255, 255, 0.7); }
you would useh1 { color: #ccc; } h1 { color: rgba(255, 255, 255, 0.7); }
Case of letters is treated as insignificant in class and identifier selectors in CSS. Thus, the selector .foo matches an element with class="Foo" or class="FOO". By CSS specifications, the case is significant in these contexts. Malformed names are accepted in class and identifier selectors. Specifically, names starting with a period or a number sign (e.g. in selectors .123a and #42) are accepted.
The declaration white-space: pre is ignored.
Fixed positioning is not supported: the declaration position: fixed is treated as position: static (on IE 7).
Many standard (CSS 2.1) additions to CSS support (such as the max-width property and attribute selectors) in IE 7 are not in use Quirks Mode. That is, there are many CSS features that were not supported in IE 6 and are supported in IE 7, but only in Standards Mode. See Microsoft’s blog entry Details on our CSS changes for IE7.
Some nonstandard CSS features (features not in CSS 2.1) such as scrollbar properties are recognized by some versions of IE and Opera in Quirks Mode but ignored in Standards Mode. On IE 8 and newer, this also applies to the expression() construct.
Setting rowspan=0 or colspan=0 is ignored in many browsers, even if they support these settings in Standards Mode. (They mean that the cell spans the rest of the row or column. This was implemented in browsers relatively lately.)
Tag soup parsing. For example, if a document contains the markup
<p>text<table>...</table>
then e.g. Firefox treats, in Quirks Mode, the p element as containing the table element. In Standards Mode, the start tag of table implicitly closes the open p element. The difference can be seen if you e.g. set a border on the p element. Similarly, for example, Firefox accepts a ul element inside a font element. IE always works by wrong rules in such issues, even in Standards Mode, but standards-conforming behavior can be achieved by using valid markup and always using explicit end tags like</p>
even when they are formally optional.Different tag soup processing. An opposite issue, more or less, is that in Quirks Mode, markup like
<font color=red><table>...</table></font>
does not affect the color of text inside the table. In Standards Mode, it does – even though the markup is nonstandard (invalid according to all HTML specifications)!White space between elements can be significant. For example, let’s say you have a list of links. Typically you would write the markup with line breaks between the list items, the li elements (that is, between
</li>
and<li>
tags):
<ul>
<li><a ...>...</a></li>
<li><a ...>...</a></li>
...
</ul>
However, if you set display: block and a border for the link elements, you may wind up with vertical gaps (empty lines) between the boxes. This happens on IE 7 in Quirks Mode, and always on previous versions of IE. On the other hand, for the markup above, if you set display: inline for the li elements, then there is no white space between the element boxes on IE in Quirks Mode. In Standards Mode, and on other browsers, there is white space corresponding to one blank, and this is regarded as standards-conforming by some.
Forms have a default bottom margin of 1em or so in some browsers. (On IE 7, there is such a margin in both modes.) This is apparently meant to continue the tradition of web browsers to leave that much spacing below a form. It used to be a frequently asked question how to get rid of the empty line after a form.
Default vertical margins are suppressed in some contexts, e.g. when a p element appears as the first element in a td element. This is more or less traditional behavior in browsers and takes place on IE 7 in both modes (on IE 8, in Quirks Mode only). The issue does not arise if the relevant elements have their vertical margins set explicitly in CSS.
Tooltip effects for img elements are based on alt attributes on some old-style browsers, including IE 8 in Quirks Mode but not in Standards Mode.
The wbr markup for a line breaking opportunity is honored. Browsers have widely supported it, but IE 8 has stopped doing so in “standards mode.” This is bad news, since
<wbr>
tags have been the only effective way to suggest line break opportunities for otherwise unbreakable strings on web pages.Mozilla browsers (like Firefox and Seamonkey) have some additional features, documented in the quirk.css file. For example, the default color for table borders is gray (as in most other browsers), as opposite to using the foreground color of the table as in Standards Mode. Note: Not all the settings in that file apply to all versions of Mozilla.
Some DOM features are not available. For example, in Quirks Mode, IE 9 does not recognize the method getElementsByClassName (which is well supported by other browsers and included in HTML5).
The so-called named access on the Window object such as using (in JavaScript) window.foo, window['foo'] or just foo to refer to the element with id="foo" is possible in Quirks Mode only in some versions of Firefox. (In version 15, it however restored support to this legacy feature in both modes.)
In Firefox, the document.all collection (in JavaScript) is recognized in Quirks Mode only.
In Firefox, in quirks mode tables with no rows/rowgroups have zero height even when a height is specified
In Firefox, in quirks mode in a FRAMESET cols/rows specification 0* is treated as 1*
And some CSS quirks:
The hashless hex color quirk
The unitless length quirk
The line height calculation quirk
The blocks ignore line-height quirk
The percentage height calculation quirk
The html element fills the viewport quirk
The body element fills the html element quirk
The table cell width calculation quirk
The table cell nowrap minimum width calculation quirk
The collapsing table quirk
The text decoration doesn’t propagate into tables quirk
The tables inherit color from body quirk
The table cell height box sizing quirk
The :active and :hover quirk
References
What happens in Quirks Mode in web browsers?
Quirks Mode Standard
Mozilla Quirks Mode Behavior - Mozilla | MDN
Interoperable HTML5 Quirks Mode in IE10 – IEBlog
HTML 5.2: Section 10. Rendering
精彩评论