Message from JavaScript discussions

November 2018

— I’m trying to attach a shadow DOM with a full document inside. I had hoped that I could just dump the full markup into a template element, but that strips the html, head and body elements.

Message permanent page


Currently, I’m creating html, head, and body elements by hand, insert the head and body markup and then I append the head and body elements to the html element. This feels ... very odd to write out.

— Wait a minute the shadow DOM was this thing in React or VueJS that renders, set HTML, only when smthing changes?

Message permanent page

— You are maybe talking about Virtual DOM?

— Oh

— Yes

— Lol

— Yikes :D

— Shadow dom is not the iframe thing, right

— What effect you try to achive?

— If you think what I think you think, it is. It allows you to attach DOM fragments to it. The goal is to isolate the shadow DOM from the parent/host DOM. The main purpose is style isolation.

Message permanent page

— My use case is rather complex. I’m rendering a full document inside another document. Currently, I manually inject the body contents into a certain element in the parent document’s body. Script, style and link tags are injected into the parent document’s head.

Message permanent page