Re: [w3c/webcomponents] Generic programs can't reliably use/manipulate documents via the DOM (#640)

>> I think the same point as for C++ and Java applies. It's not a 'thing' as far is the user is concerned. Go wild.
>
> Well, then that same argument holds for closed shadow trees.

Hardly. The DOM is always meaningful, since it represents the user interface/user-facing content in a standardised way. If you give me a DOM (and the relevant styles, admittedly), I can tell you what it represents and do useful things with it. Not so with arbitrary internal private states -- their representation is only meaningful in the context of that specific program.

> It's not really a thing to go into some component's shadow tree and mess with it.

I think you may have misinterpreted me: I meant that ECMAScript internal state isn't a virtual object in the mind of the user. DOM elements certainly are. Nonetheless, this is patently false; programs already do this. That you don't like it doesn't make it not a 'thing'. 

The thing that's made the web so powerful up until now *is* the DOM. Search engines rely on the DOM. Libraries rely on the DOM. Extensions rely on the DOM. Accessibility programs rely on the DOM. People have been able to re-use huge amounts of code because the underlying objects are all the same, and all accessible.

This all dies when your documents are full of opaque `<main-content>`s and `<autocomplete-input>`s and mine are full of `<article-body>`s and `<filter-dropdown>`s. Or worse, 'empty' `<div>`s. The objects in the DOM can't reliably convey any meaning to cross-document programs, unless they learn to read the developers' minds. This ruins the web.

I'll quote my example from above here, in the hopes that you have a response to it:

> Suppose a library wanted to provide an easy way to attach keyboard shortcuts to a page, except when the user is entering text into an input (`<input>`, `<textarea>` `<* contenteditable="true">`, etc.). This library will function incorrectly (ie. interpret input-generating keypresses as keyboard shortcuts) for any pages containing an input inside a closed shadow DOM.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/640#issuecomment-301246320

Received on Saturday, 13 May 2017 12:52:34 UTC