Tuesday, October 21st, 2008

CSS Expressions are no more in IE 8 standards mode

Category: Browsers, IE

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

The CSS expressions of old will no longer work in IE 8. Whenever a feature goes away in IE, Ajax hackers get worried, as many hacks rely on quirks or proprietary features of the browser.

Why did Microsoft choose this course?

  • 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.

The feature will still exist in IE 7 and quirks modes, but consider yourself warned and that it is time to use the new CSS 2.1 support and the like to get around the issues that CSS expressions (or Dynamic Properties) came about to solve.

Do you ever use this feature? Run into any issues where the new support doesn’t give you everything you need? Now is the time to let Microsoft know.

Posted by Dion Almaer at 6:32 am

4 rating from 26 votes


Comments feed TrackBack URI

I can’t believe they’re doing such big changes and don’t want to rename their XMLHttpRequest object… pff…

Comment by ahFeel — October 21, 2008

I only use CSS expressions for fixing IE6 CSS issues like the missing max-width property, so removing this in IE8 is great, as long as the browser really supports CSS 2.1 fully.

Comment by torerik — October 21, 2008

@torerik it will (hopefully with no bugs): http://msdn.microsoft.com/en-us/library/cc351024.aspx

I wanted bits of CSS3 (border-radius/multiple backgroundimages …)

IE8 is a big step ahead but it will stay way behind other browsers if they don’t push (core) updates more often!

Comment by Marin — October 21, 2008

Now Microsoft you just have to get my 1 million IE6 users to switch over to a current browser.

Comment by JaxPhper — October 21, 2008

1 million? 300 Million or so.

Comment by Aimos — October 21, 2008

Long Live Quirks Mode!

Ahem. So what’s the ‘standards compliant’ workaround for css:expression?


Comment by wwwmarty — October 23, 2008

Now how do we do make alternating colors for even/odd rows in IE8 standards mode?

It doesn’t support nth-child() and it doesn’t do expression(this.rowIndex%2?””:””) anymore.

Comment by Jaaap — October 20, 2009

Leave a comment

You must be logged in to post a comment.