How to create a cross-browser sub document with iframe or shadow dom?
I want to create a totally encapsulated sub-document in JavaScript, with its own <head> , <body> , styles, html, and js. Basically a shadow dom, or an iframe, but without an src attribute. Though I love the idea of shadow dom, its support is very low, and thus is not ready for prime time. So I have been working on creating an iframe, but have been hitting various road-blocks along the way. Here is a jsFiddle demonstrating my various attempts. The iframe cannot exist in the dom. This part is critical. To clarify, it is okay if it momentarily exists in the dom, but it must be able to be