Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DocumentFragment browser support

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?

like image 581
Eineki Avatar asked Aug 30 '09 07:08

Eineki


3 Answers

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

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

like image 97
James Avatar answered Nov 20 '22 12:11

James


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).

like image 25
bobince Avatar answered Nov 20 '22 11:11

bobince


         ╔═════════════════════════════════╗
         ║ 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.
like image 4
Knu Avatar answered Nov 20 '22 12:11

Knu