admin管理员组文章数量:1415684
I am in the process of converting my application to use XHTML strict mode (it didn't have a DOCTYPE before). However, I noticed a significant degradation when getting offsetHeight/offsetWidth. This is very noticeable on pages with large number of DOM elements, let's say a table with 1 column by 800 rows, the cells only have a piece of text. Visiting each descendant element in that table to obtain their offset dimension is way slower than when IE renders the page in Quirks mode. Why is that the case? and does anybody know tips to help IE calculate those offsetValues?
I am in the process of converting my application to use XHTML strict mode (it didn't have a DOCTYPE before). However, I noticed a significant degradation when getting offsetHeight/offsetWidth. This is very noticeable on pages with large number of DOM elements, let's say a table with 1 column by 800 rows, the cells only have a piece of text. Visiting each descendant element in that table to obtain their offset dimension is way slower than when IE renders the page in Quirks mode. Why is that the case? and does anybody know tips to help IE calculate those offsetValues?
Share Improve this question asked Aug 21, 2010 at 1:29 PaulPaul 3191 gold badge4 silver badges9 bronze badges 1- do you have any samples to demonstrate this? – lincolnk Commented Aug 23, 2010 at 4:06
2 Answers
Reset to default 2 +50I would suggest to force IE to render you page in standards mode not in quirks. This can be done by adding a meta tags on the head of your html document or setup the web-server to add X-UA-Compatible headers.
<meta http-equiv="X-UA-Compatible" content="IE=8;FF=3;OtherUA=4" />
Also, use built-in javascript frameworks such as jquery,prototype, yui, etc, most be of them already addressed the issues on different rendering engines.
@bobince: The issue I believe is around reflow. The logic in my JavaScript tries to figure out if children are overlapping each other (since they get dynamic content that I can't predict) in an absolute layout container and then adjusts the parent's css dimensions and sibbling's css that need to shift down. Changing the css dimensions trigger reflow and this happens in the middle of my iteration, this scenario seems to be much slower in IE8 standards than in IE8 Quirks for very large tables. I know that I should hide or use documentFragment when doing this type of operations, however because I need things to move and then look at the new offset dimensions I was getting inaccurate values.
本文标签: javascriptIE 8 Quirks vs Standards retrieving offsetHeightoffsetWidthStack Overflow
版权声明:本文标题:javascript - IE 8 Quirks vs Standards retrieving offsetHeightoffsetWidth - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745238639a2649186.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论