Re: [whatwg/dom] Declarative Shadow DOM (#831)

> But that lack of control extends to the content of the declarative shadow DOM. It's very easy to imagine scenarios in which there's a version mismatch (including version changes that aren't considered breaking, because changing a shadow DOM classname could be considered an internal implementation detail)...
> ...or something as simple as a misconfigured HTML minifier treats whitespace in a way that causes the DOM structure to be just different enough that this.p = element.childNodes[3] no longer works.

Thanks for the examples. The first definitely seems to me like user (or perhaps documentation?) error. I would hope that the documentation example would look more like this:

```html
<distributable-widget>
  <!-- leave this empty - the component will populate it -->
</distributable-widget>
<script type="module" src="https://unpkg.com/distributable-widget@1"></script>
```

The HTML minifier example is interesting - I agree that this could cause problems. But wouldn't that be a "brittleness" in the component code? I know it is commonplace, but I always cringe when I see things like `thirdButton = parent.childNodes[3]`. That's brittle even without declarative Shadow DOM. 

I do see the point, though. I'm open to suggestions on how to reduce this potential class of problems.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/831#issuecomment-586422247

Received on Friday, 14 February 2020 18:55:17 UTC