I wonder whether it mak开发者_开发百科es sense to use CSS expressions if you can just use javascript.
Which would be a better or faster?
Do CSS expressions work with disabled js?
CSS expressions are non-standard, and only available in IE.
Don't use them (except in very rare cases where they're useful to hack IE to make it do something that other browsers can do anyway).
As for performance, since expressions are themselves Javascript code, I can't imagine any scenario where they'd be quicker than plain Javascript. If anything, I'd expect it to be slower, but I don't have any firm stats on that.
For the same reason, I'd also expect it to be disabled when JS is disabled, but again I haven't got any proof of that, and I don't have time to investigate it. If it were to be run when JS was disabled, it could be considered a security risk, as disabling JS is usually done to mitigate risky scripting, and that would provide a way of circumventing it. I doubt it though, because the hackers of the world would have been all over it by now.
CSS expressions are a wart on an already ugly browser: IE. Standard advice is to avoid them whenever possible if performance is a concern.
Javascript would definitely be faster and better. The majority of people now-a-days don't have javascript disabled so I wouldn't worry about it. If they have it disabled then not only will your site not work properly but most every other site out there. I would avoid using CSS expressions all together.
精彩评论