Re: [whatwg/dom] Composed shadow DOM (#531)

Thank you for the proposal. Let me try to share a couple of my thoughts, from a spec editor's and implementor's perspective:

As you are already aware of it, I think there is a kind of misunderstanding:

- Having only CSS encapsulation is much easier than having both CSS encapsulation and DOM encapsulation

I think that is wrong assumption. As you know, CSS works on DOM-basis. It would be more difficult to separate both, from an engine's perspective.

For example, I am sure that most engines have a { #id -> element } mapping for fast lookup for `querySelector('#id')` or CSS selector matching: `#id { color: xxxx }` or something.
We needs such a hashmap per a DOM tree because a DOM tree is a scope of CSS selector matching.

If we are to have only CSS encapsulation, it is unclear where and how we can maintain this mapping.
We have to maintain this hashmap dynamically, reacting each DOM mutation, inspecting tree structures. That is a non-trivial task for an engine; having a real DOM tree and such a pseudo-tree for CSS encapsulation where they are interleaving.

Eventually, we want to have a *shadow tree* like concept, internally, so that we can keep track of each "unit of CSS scoping".

That is 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/whatwg/dom/issues/531#issuecomment-341609348

Received on Friday, 3 November 2017 02:24:42 UTC