You’re viewing an archive of outdated material. Visit The Web Standards Project’s updated site to learn about our current mission.

Incorrect Error Handling

The error-handling in IE's CSS parser is dangerously lenient. The CSS1 specification explains clearly how things should be handled (i.e., what to ignore), but IE fails to follow much of this part of the standard.

To demonstrate this graphically, this page has the following stylesheet:

     BODY { background: white none; color: black; }
     P { text-indent: 0; }
     H1 + P { text-indent: 3em; } /* Should only affect the first P */
     @media tty {                 /* Block should be ignored by IE */
       H1 { color: red; }
       P  { color: red; }
     }

The effect of this sheet should, on graphical browsers, be a white background with black text. Any red text indicates an error. Also, CSS2-compliant browsers would indent only the first paragraph on this page while CSS1-compliant browsers that do not support CSS2 would not indent any paragraphs.

The Examples Described

The first rule which we'll focus on is the following:

     H1 + P { text-indent: 3em; }

IE should ignore this completely (since it doesn't yet recognise CSS2's adjacent sibling selectors), but it doesn't. It indents all paragraphs when it should indent none of them.

The second part of the test causes an even more frequently found problem in IE's error handling code to appear, one related to unknown at-rules:

     @media tty {
       H1 { color: red; }
       P  { color: red; }
     }

In IE, this code makes paragraphs red, although it should not have any effect on a graphical browser's rendition of this document at all (this construct actually signifies that text-only browsers, such as Emacs/W3, should draw paragraphs and H1 headers in red). This is a serious problem for authors of stylesheets that are basing their work on future and not-yet-implemented standards.