Re: Component Models and Encapsulation (was Re: Component Model: Landing Experimental Shadow DOM API in WebKit)

On 6/30/11 5:45 PM, Dimitri Glazkov wrote:
> There's a very interesting distinction here. You don't "attach"
> components to DOM elements. DOM elements _are_ components. The only
> way to make a component is by sub-classing it from an existing
> element. In this case, there is no distinction between native and
> non-native implementations. If I sub-class from HTMLTextareaElement, I
> can either reuse or override its shadow DOM.

Back up.

In this particular case, there may well be behavior attached to the 
textarea that makes assumptions about the shadow DOM's structure.  This 
seems like a general statement about components.

So if you override a shadow DOM, you better override the behavior too, 
right?

If you reuse the shadow DOM, you either don't get access to it from your 
component, or the old behavior still needs to be unhooked (since you can 
now violate its invariants).

Does that match your mental model?  Or are we talking about totally 
different things somehow?

-Boris

Received on Thursday, 30 June 2011 21:51:20 UTC