Message from JavaScript discussions
November 2018
— *But*, I believe my issue is less with shadow DOM. Atleast at this point in time. I try to store a full document as a document fragment so that I can append it later. This doesn’t seem to work with the template
element, though.
Shadow dom, as i understand it, is designed to visually hide contents from developer, its not very useful, imo
— Like, you implement your custom widget and hide the complexity from those who will use it
— Yes, it basically tries to make the markup untouchable. in a way.
— I’m just trying to explore whether I can still use it for my case.
— You can override css styles adding more specificity to the render point, i think it will be easier. i dont know.
— That would require ne to actually touch and alter any CSS that I get. I’d like to avoid that as well. The ideal would be a completely independent document. I’m very far from that ideal as currently, we isolate styles by prefixing all selectors etc. That way, no styles leak out to the parent document, but styles from the parent document can still leak in.
— Its not possible without re-parsing, i believe. the shortest way to adapt css, i see, is to wrap all rules in #id {...} of each css file of that doc, compile it on server side and then inject into document.styleSheets
— So.. as you do
— This project is very much a prototype in development. A top-level goal is to keep all implementation as decoupled from the document I want to embed as possible. If that’s not feasable, steps like processing CSS would be necessary, but I try to avoids that.
— Why not iframe?
— I tried that, but it was extremely iffy.