This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 18535 - [Custom]: Scoping of element definitions in Shadow DOM
Summary: [Custom]: Scoping of element definitions in Shadow DOM
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Component Model (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Dimitri Glazkov
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 17103
  Show dependency treegraph
 
Reported: 2012-08-10 23:16 UTC by Dimitri Glazkov
Modified: 2012-08-24 20:31 UTC (History)
2 users (show)

See Also:


Attachments

Description Dimitri Glazkov 2012-08-10 23:16:33 UTC
Should element definitions (the <element> thingies) be scoped inside
of a shadow DOM subtree?

That is, in parallel with id/name/selector scoping, would it make
sense to do the same with element definitions?

This means that you will have to explicitly state which components you
want to use inside of each <element>, but also means that you can have
a whole set of internal components that aren't surfaced to the
document.

Example:

Bob has framework A and framework B used on his page. Both define
x-qux, and A one wins. Bad news for framework B, which happens to also
use it in its components.
Comment 1 Tab Atkins Jr. 2012-08-10 23:39:50 UTC
Experience suggests that this kind of collision is easily worked
around by library authors, by a combination of simple prefixing and just googling for names beforehand.  I don't think we need to give it a technical solution.
Comment 2 Dominic Cooney 2012-08-13 03:34:25 UTC
(In reply to comment #0)
> Should element definitions (the <element> thingies) be scoped inside
> of a shadow DOM subtree?
> 
> ...
> 
> This means that you will have to explicitly state which components you
> want to use inside of each <element>, but also means that you can have
> a whole set of internal components that aren't surfaced to the
> document.

The proposed solution might be workable for large, complex components that have a single instance on a page. However if there are going to be multiple instances of a component on a page, something that means each instance has its own copy of the element definitions sounds heavyweight.

(In reply to comment #1)
> Experience suggests that this kind of collision is easily worked
> around by library authors, by a combination of simple prefixing and just
> googling for names beforehand.  I don't think we need to give it a technical
> solution.

Is it so easily worked around?

What about the related problem of integrating two copies of different versions of the same script library in the same page?
Comment 3 Dimitri Glazkov 2012-08-16 16:01:10 UTC
Also, what happens with elements that aren't in tree?
Comment 4 Dimitri Glazkov 2012-08-24 20:31:15 UTC
http://dvcs.w3.org/hg/webcomponents/rev/da7ba1b845b3

Made it iterate all enclosed trees for now. We can get back to this later.

Split the free-standing elements question into bug 18684.