3 ms·
Currently using the similar `DOMImplementation.createHTMLDocument()`: https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument http
by NVRM 8y ago
Currently using the similar `DOMImplementation.createHTMLDocument()`: https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument https://developer.mozilla.org/en-US/docs/Web/API/DOMImplemen... : Styles and scripts of the main document doesn't apply to it. It allow to do some tricky stuffs, the main doc can retrieve values of sub documents, and we aren't forced to display it. It can act in the shadow too, allowing parallel computing. Is it the great beginning of «in browser javascript multi threading»?
- Arnavion 8y ago>Styles and scripts of the main document doesn't apply to it. Ugh. I look forward to being unable to use custom JS / CSS to fix websites that have banners that cover half the page, or `max-width`s on their body to constrain themselves to tablet sizes on desktop monitors...
- RobertRoberts 8y agoI had never considered this before. Would Shadow DOM make browser plugins like Stylish useless against horribly layed out websites? There has to be a work around for this issue...
- JeremyBanks 8y agoIt used to be possible to write "shadow-piercing" CSS selectors, but this capability was removed for making it too easy to violate the encapsulation. (And indeed, I saw it frequently used to accommodate misuse of the Shadow DOM API.) https://developers.google.com/web/updates/2017/10/remove-shadow-piercing https://developers.google.com/web/updates/2017/10/remove-sha... It sounds like "Shadow Parts" will let you target subcomponents in some Shadow DOMs, once it's implemented, but I'm afraid that's probably not going to help you with misbehaving websites.
- rictic 8y agoStill definitely possible for browser plugins to do anything they want to Shadow DOM. For open shadow roots, javascript can crawl them. If handling closed shadow trees is necessary, just patch Element.prototype.attachShadow and keep a WeakMap from the Element instance to its shadow root.
- deleted 8y ago[deleted]
- NVRM 8y agoMaybe not related, but we can style frames in various shapes with css clip-path. It start to be reliable. https://developer.mozilla.org/en-US/docs/Web/CSS/clip-path https://developer.mozilla.org/en-US/docs/Web/CSS/clip-path
- egeozcan 8y agoWhat is the difference between this and working with a frame? I guess one could be the security policy (this being more flexible than a blank frame document which is automatically of different origin), but is there anything else?
- NVRM 8y agoIt is using iframes, that can be sanboxed in many ways. The security policy apply for external domains, if declared in header. It is a way to create a whole valid DOM quickly, it is identical as creating it by hand. Then we can use window postMessage, or simply from the main document retrieve stuffs in the children DOM with like `frame007.contentDocument.documentElement...`
- JeremyBanks 8y agoEDIT: I misunderstood the parent comment; it's not talking about Shadow DOM. --- > It can act in the shadow too, allowing parallel computing. Is it the great beginning of «in browser javascript multi threading»? Unless something has recently changed, this is not true. Shadow DOM elements are still part of the same JavaScript execution environment as the Light DOM; there's no concurrency at that level. If you want browser multi-threading, we've had WebWorkers for years and they keep getting better (OffscreenCanvas and module support being current examples).