You can use attachShadow
to create a shadowDOM, but there is no api like removeShadow
or any other offcial way to remove it, that's why?
Why this design?
Asked
Active
Viewed 310 times
1

Yorn Qiu
- 29
- 2
-
the real question is, why do you need to remove it – Bravo Jun 21 '22 at 03:25
-
Closing it makes it inaccessible and `null` which is about as close to being removed as you could get. – zer00ne Jun 21 '22 at 03:33
-
Does this answer your question? [How to remove a shadow root from an HTML element adorned with a Shadow DOM from a template?](https://stackoverflow.com/questions/20090059/how-to-remove-a-shadow-root-from-an-html-element-adorned-with-a-shadow-dom-from) – SuperStormer Jun 21 '22 at 04:12
-
@SuperStormer Actually, I'm posting this after I read the question you mentioned. I mean, there's always a way to remove the shadowRoot, but ECMA seems to prefer people not do this, intentionally. This is what I don't understand. – Yorn Qiu Jun 21 '22 at 09:08