I wonder whether it makes 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?
I wonder whether it makes 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?
Share Improve this question edited Apr 29, 2012 at 3:34 Knu 15.2k6 gold badges59 silver badges92 bronze badges asked Jul 7, 2011 at 15:40 Vitaly BatonovVitaly Batonov 1,1323 gold badges12 silver badges22 bronze badges 1- 3 Related: developer.yahoo./blogs/ydn/posts/2007/07/high_performanc_6 – No Results Found Commented Jul 7, 2011 at 15:45
3 Answers
Reset to default 8CSS 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.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745226727a4617495.html
评论列表(0条)