When adding the below style attribute on a popular website in IE7 emulator nothing happened, but when I execute it from a trivial website in IE7 emulator it does get executed.
<body style="width: expression(alert())">
How can you prevent the expression from being executed?
The feature you are talking about is called
Dynamic Properties
and is no longer supported as of IE8.