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 16764 - [Shadow]: host attribute makes it hard to preserve encapsulation
Summary: [Shadow]: host attribute makes it hard to preserve encapsulation
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: 14978
  Show dependency treegraph
 
Reported: 2012-04-17 23:40 UTC by Dominic Cooney
Modified: 2012-04-25 23:21 UTC (History)
0 users

See Also:


Attachments

Description Dominic Cooney 2012-04-17 23:40:29 UTC
Take this use case: a component wants to provide a place for extension. For example, a video player may put playback controls in Shadow DOM but wants to let scripts add buttons to the controls.

The component could do this:

<!-- play/pause button -->
<div id="extensionpoint"></div>

and implement the extensionPoint attribute as:

this.extensionPoint = new ShadowRoot(controls.querySelector('#extensionpoint'))

Scripts can access the extensionPoint and add buttons to it, etc.

However the component can’t preserve its own encapsulation, because the extensionPoint.host property will point into the component’s shadow.

One way around this is for the component to do this:

<!-- play/pause button -->
<content select=".extensions"></content>

And the caller writes:

<…>
  <div class="extensions">…</div>
  …

But it seems a shame that we lose the imperative API by having the "host" property. What is it good for?
Comment 1 Dimitri Glazkov 2012-04-25 23:19:10 UTC
Good use case. I will remove .host attribute.
Comment 2 Dimitri Glazkov 2012-04-25 23:21:25 UTC
http://dvcs.w3.org/hg/webcomponents/rev/57f8cfc4a7dc