最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - DocumentFragment browser support - Stack Overflow

programmeradmin3浏览0评论

Today I stumbled on createDocumentFragment. I was wondering if the DocumementFragment is supported, and how, on the different browsers, expecially IE series.

Anyone knows anything about this subject?

Today I stumbled on createDocumentFragment. I was wondering if the DocumementFragment is supported, and how, on the different browsers, expecially IE series.

Anyone knows anything about this subject?

Share Improve this question asked Aug 30, 2009 at 7:51 EinekiEineki 14.9k6 gold badges53 silver badges60 bronze badges 1
  • 1 stackoverflow.com/questions/1643349/… See NickFitz's comment. Fragment are treated by IE as documents. msdn.microsoft.com/en-us/library/ms536387%28VS.85%29.aspx – Olivvv Commented Dec 8, 2009 at 14:35
Add a comment  | 

3 Answers 3

Reset to default 13

Yep, it's fully supported in all modern browsers (including IE6).

See: http://www.quirksmode.org/dom/w3c_core.html#miscellaneous

In general it has always worked fine as per the DOM spec.

But don't expect non-standard extensions to work seamlessly... for example you can't set innerHTML on a DocumentFragment (which is a shame as it could have greatly improved insertion speed on some large pages).

         ╔═════════════════════════════════╗
         ║ document.createDocumentFragment ║
╔════════╬═════════════════════════════════╣
║ IE5    ║ true                            ║
║ IEM5.2 ║ true                            ║
║ IE5.5  ║ false                           ║
║ IE6+   ║ true                            ║
║ OPM6+  ║ true                            ║
║ OP7+   ║ true                            ║
║ N6+    ║ true                            ║
║ KQ     ║ true                            ║
╚════════╩═════════════════════════════════╝

Beware though, existence doesn't always entails implementation.

Gotchas

  • IE Mac 5.2 on Mac cannot add text nodes to document fragments, nor append the fragment's contents to a document.
  • Opera 7.2 creates the fragment but does not apply styles to the created elements.
发布评论

评论列表(0)

  1. 暂无评论