Ending Expressions

Design criteria such as standard compliance, performance, reliability and security framed the design of IE8 as whole, for new as well as existing features. As a result, CSS expressions are no longer supported in IE8 standards mode. This change was announced previously on the IE blog, however, this post will provide a few more details about that decision. The following FAQ will give a quick overview of the feature, the rationale behind our design decision and what it may mean for your own site.

What is a CSS expression ?

Also known as ‘Dynamic Properties’, this proprietary CSS extension was introduced in Internet Explorer 5. Long before JavaScript libraries such as jQuery or Dojo were conceived, it allowed web developers to dynamically bind script to the page through CSS selectors. As an example, the following CSS declaration updates the background color of certain page blocks depending on the time of day :

div.title { background-color: expression( (new Date()).getHours()%2 ? "#B8D4FF" : "#F08A00" ); }

Why end support for expressions ?

  • To comply with standards
    • Expressions are proprietary to Internet Explorer and as such not interoperable.
    • A common use-case for expressions was to fix IE bugs or to emulate those CSS 2.1 features not yet supported by the browser, for example, min-width and max-width. We have not only worked hard to fix these bugs in IE8 but our new layout engine supports the missing features natively.
  • To improve performance
  • To reduce the browser attack surface
    • Because they expose a script execution context, CSS expressions constitute a possible script injection attack vector.

Are expressions still available in IE7 and Quirks mode ?

Yes. For backward compatibility, CSS expressions are still executed in Quirks and IE7 Strict modes. But starting with IE8 Beta 2, they are ignored in IE8 Standards mode.

Pages on my web site depend on CSS expressions. How does this affect me ?

Thanks to IE8’s new layout engine, most expressions written to work around CSS 2.1 bugs and shortcomings should no longer be needed; we expect unsupported or incorrectly interpreted properties to work in a standard, interoperable way. For those expressions supporting more specific purposes, anything they do is inherently achievable using standard JavaScript, usually interoperably and at lower runtime costs. The specifics will of course depend on your application. Based on your feedback to this post, we may visit examples in future installments.

Ending support for expressions - a feature often used to fix the very issues we have worked hard to address in this release – helps make IE8 more standard, faster and more secure for our users.

Sylvain Galineau
Program Manager