Tuesday, October 21st, 2008
CSS Expressions are no more in IE 8 standards mode
-
-
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
- Expressions evaluation has a high runtime cost; web performance experts like Steve Souders recommend avoiding them to improve front-end 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.












I can’t believe they’re doing such big changes and don’t want to rename their XMLHttpRequest object… pff…
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.
@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!
Now Microsoft you just have to get my 1 million IE6 users to switch over to a current browser.
1 million? 300 Million or so.
Long Live Quirks Mode!
…
Ahem. So what’s the ’standards compliant’ workaround for css:expression?
width:expression(document.body.clientWidth/MyScalingVariable);