Re: Component Model: Landing Experimental Shadow DOM API in WebKit

On 6/29/11, Dimitri Glazkov <dglazkov@chromium.org> wrote:
> Hi Folks!
>
> With use cases (http://wiki.whatwg.org/wiki/Component_Model_Use_Cases)
> firmed up, and isolation
> (http://lists.w3.org/Archives/Public/public-webapps/2011JanMar/0900.html),
> inheritance
> (http://lists.w3.org/Archives/Public/public-webapps/2011JanMar/0941.html)
> out of the way, a component model for the Web can be viewed as a
> three-piece puzzle:
>
> 1) Shadow DOM (http://glazkov.com/2011/01/14/what-the-heck-is-shadow-dom/)

| var slider = document.getElementsById("foo");
| console.log(slider.firstChild); // returns null

In which browser?

| // Create an element with a shadow DOM subtree.
| var input = document.body.appendChild(document.createElement('input'));
| // Add a child to it.
| var test = input.appendChild(document.createElement('p'));

What should that do, other than throw an error?

> with its encapsulation properties in regard to events, styles, and DOM
> scoping;
> 2) Associating a chunk of shadow DOM and Javascript behavior with a
> DOM element -- that's the actual "Component" part;

I've always wanted a method to clone events and js properties, so you
can have say:

form.cloneObject(true);

And that form's controls will retain its their `value`, `checked`, et al.

> 3) Declarative (markup) way of expressing the above.
>
> Since this is still a largish puzzle, difficult to solve by
> theoretical examination, we would like to start by landing the first
> piece (the shadow DOM bits) as an experimental API in WebKit.

I've got another idea but I'm not going to say what it is.
-- 
Garrett

Received on Thursday, 30 June 2011 22:04:27 UTC