Git Product home page Git Product logo

webcomponents's Introduction

Web Components

Web Components are a new browser feature that provides a standard component model for the Web, consisting of several pieces maintained in different places:

Issues

Please file issues in the most specific repository possible, per the above issue pointers. (It's often not this repository.)

Abandoned features:

webcomponents's People

Contributors

abdonrd avatar afbarstow avatar annevk avatar behowell avatar chaals avatar cvrebert avatar dandclark avatar darobin avatar dglazkov avatar domenic avatar dominiccooney avatar hayatoito avatar koba04 avatar omo avatar padamczewski avatar philipwalton avatar plehegar avatar prayagverma avatar rafaelw avatar rakina avatar rianby64 avatar rniwa avatar shvaikalesh avatar sideshowbarker avatar siusin avatar stevefaulkner avatar takayoshikochi avatar tobie avatar travisleithead avatar ylafon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webcomponents's Issues

[Shadow] Change the order of insertion points which are involved in a re-distribution in event path (bugzilla: 23887)

Title: [Shadow] Change the order of insertion points which are involved in a re-distribution in event path (bugzilla: 23887)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c0
Olli Pettay wrote on 2013-11-22 10:34:35 +0000.

To not break consistency with normal DOM where if a node is in
event path, also its parent node is in the path, Shadow DOM shouldn't put
non-final destination insertion points to the path.


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c1
Hayato Ito wrote on 2013-11-22 10:42:43 +0000.

Sounds reasonable. Thank you for filing the bug!
Let me update the spec. I think there is no concern for that.


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c2
Hayato Ito wrote on 2013-11-25 04:56:47 +0000.

+sorvell

Do you have any opinion for this proposal?

My concern is whether Polymer depends on the behavior of the current event path or not.

I don't think we want to include intermeidiate insertion points in the event path, but I'd like to make sure we really don't need that.


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c3
Steve Orvell wrote on 2013-11-25 18:11:56 +0000.

Can we have an example to work with to see the problem more clearly?

Is the proposal to change just the information exposed in event.path or to change the set of elements to which events bubble?

My concern is that this will interact poorly with composition. It seems desirable to maintain the invariant that event handlers on insertion points can see events which bubble from elements distributed to them.


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c4
Hayato Ito wrote on 2013-11-26 00:04:47 +0000.

(In reply to Steve Orvell from comment #3)

Can we have an example to work with to see the problem more clearly?

Is the proposal to change just the information exposed in event.path or to
change the set of elements to which events bubble?

Both. Both uses the result of event path calculation algorithm. http://w3c.github.io/webcomponents/spec/shadow/#event-paths

My concern is that this will interact poorly with composition. It seems
desirable to maintain the invariant that event handlers on insertion points
can see events which bubble from elements distributed to them.

Let's use the example. See Fig.4
http://w3c.github.io/webcomponents/spec/shadow/#distribution-results

When a click event happens on child1 node,

  • Event listeners registered on insertion point 1 can't see the click event because child1's final destination is not insertion point 1.
  • Event listeners registered on insertion point 3 can see the click event because child1's final destination is insertion point 3.

I supposed that insertion point 1 doesn't have to see events which happened on child1.


comment: 5
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c5
Steve Orvell wrote on 2013-11-26 01:47:00 +0000.

Thanks for the example, yes, I am not in favor of this change for the reason stated in #3: it does not interact well with composition.

If an element host-1 like this:

SR

I must be guaranteed that host-1 can see events on its element independent of what host-2 does. This is necessary to preserve the integrity of the subtree from the perspective of host-1's shadowRoot.

Note that even in this example: http://jsbin.com/IhIziHo/1/edit where host-2 entirely replaces the rendered subtree, the basic flow of events is maintained. If child-1 fires a bubbling event, then host-1's content must see the event.


comment: 6
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c6
Olli Pettay wrote on 2013-11-26 12:40:32 +0000.

(In reply to Steve Orvell from comment #5)

If an element host-1 like this:

SR

I must be guaranteed that host-1 can see events on its element
independent of what host-2 does.
Why? You can add listener to host-2.
And it is very odd that if you have
listener both on host-2 and on content, both get called, per the current spec.


comment: 7
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c7
Steve Orvell wrote on 2013-11-26 17:09:50 +0000.

Why? You can add listener to host-2.

Whether host-2 has a shadowRoot and what it does to it is not a detail I should need to be aware of when I'm setting up listeners inside host-1's shadowRoot.

And it is very odd that if you have
listener both on host-2 and on content, both get called, per the current spec.

It's a natural consequence of host-1's content being in the event path, which I don't find odd =).


comment: 8
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c8
Olli Pettay wrote on 2013-11-26 17:41:53 +0000.

It is very odd from normal DOM event dispatch point of view.


comment: 9
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c9
Hayato Ito wrote on 2013-11-27 02:01:18 +0000.

This might be a good opportunity to discuss how event path should be.

In the most strictest world, I don't think we should add either insertion points, whether it's final destination or not, or shadow roots to an event path. If we don't add these to the event path, the event path would become equivalent to just "the ancestors in the composed tree". That would make the spec simpler. :)

But I think that's a kind of ego of a spec editor. :) I guess that is very handy and convenience for developers if we add insertion points or shadow roots to the event path. That will make it easy for developers to listen events for distributed nodes, I think.

If some developers don't like this dirty world, I think they can simply ignore all insertion points or shadow roots in the event path. That shouldn't interfere outer world essentially, should it? If we can close our eyes on events which happen on insertion points or shadow roots, the current event dispatching model might be close to the normal DOM event dispatch point of view.

I don't have a strong opinion for this issue. Let's discuss and make the spec better one.


comment: 10
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c10
Dimitri Glazkov wrote on 2013-11-27 04:51:25 +0000.

I totally agree that these insertion points in an event path are odd. They stink. I also think Steve is right -- you need this oddity to preserve composition properties.

Otherwise, it would be very hard for UI controls to reason about what's happening to elements, distributed into their insertion points without also being aware of all other shadow trees. Which is a bad thing.


comment: 11
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c11
Olli Pettay wrote on 2013-11-27 11:54:19 +0000.

We should aim for clean and consistent APIs. The current event propagation in
shadow DOM isn't such.

What is the real world use case for having non-final insertion points
in the path?

Since an insertion point may not be the final, it is anyway impossible
to know what is happening to the element distributed to insertion points.
The element may be in some totally different place in the final tree than
what the initial shadow tree expects. So I don't quite understand the "preserve composition properties" argument.

Also, one can always add event listeners to the elements in the
insertionPoint.getDistributedNodes() list.


comment: 12
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c12
Olli Pettay wrote on 2013-11-27 12:02:11 +0000.

Need to perhaps change getDistributedNodes() handling a bit to make it
useful, since one should be able to observe changes to that list.


comment: 13
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c13
Olli Pettay wrote on 2013-11-27 17:54:48 +0000.

Unless I'm missing something in the spec,
the current setup let's also
the same event to be handled twice in an insertion point.

-SH1

  • SR1
    • IP1
      • SH2
        -SR2
        -IP2
  • Child

I know that setup is odd, but nothing seem to prevent adding shadow host
under an insertion point and if there is then an insertion point, it will be
the final, yet the other insertion point is in the event path too.
So event would be dispatched from child:
Child->IP1->IP2->SR2->SH2->IP1(again)->SR1->SH1


comment: 14
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c14
Steve Orvell wrote on 2013-11-27 21:47:11 +0000.

What is the real world use case for having non-final insertion points
in the path?

I'll take a shot at this. Be kind, it's a little contrived. I start by making a fancy-list element that has a shadowRoot with a in it and I want to see the events on my list items so I put a listener on the content element:

fancy-list
SR

It works and I'm happy. Then I decide to decorate my list with another element:

fancy-list
SR


I know that fancy-decoration will show my list items and it looks nice so it makes fancy-list better.

Now I'm stuck because fancy-list unexpectedly stopped working. If I move the event listener, it'll work, but do we really expect developers to understand that they need to do this? This seems pretty arcane.


comment: 15
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c15
Steve Orvell wrote on 2013-11-27 21:52:50 +0000.

(In reply to Olli Pettay from comment #13)

Unless I'm missing something in the spec,
the current setup let's also
the same event to be handled twice in an insertion point.

Handling the event twice would be bad, no argument there.

I know that setup is odd, but nothing seem to prevent adding shadow host
under an insertion point

I'm not quite sure I follow this. Is SH2 a child of IP1? If so, it's fallback content in the insertion point and would only render if Child was not selected by IP1 so I'm not quite sure how the resulting event flow could occur.


comment: 16
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c16
Steve Orvell wrote on 2013-11-27 21:55:47 +0000.

(In reply to Hayato Ito from comment #9)

This might be a good opportunity to discuss how event path should be.

In the most strictest world, I don't think we should add either insertion
points, whether it's final destination or not

I would prefer this to the proposal here (only the last insertion point in the path).

If insertion points are sometimes in the path, I worry that it will be too confusing to know when they can be used and it will become an anti-pattern to attach listeners there.

So my preferences in order are:

  1. all insertion points in event path.
  2. no insertion points in event path.
  3. last insertion point in event path.

comment: 17
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c17
Hayato Ito wrote on 2013-11-28 01:54:04 +0000.

(In reply to Steve Orvell from comment #15)

(In reply to Olli Pettay from comment #13)

Unless I'm missing something in the spec,
the current setup let's also
the same event to be handled twice in an insertion point.

Handling the event twice would be bad, no argument there.

If this happens in any cases, that means there is a serious error in the spec.

I know that setup is odd, but nothing seem to prevent adding shadow host
under an insertion point

I'm not quite sure I follow this. Is SH2 a child of IP1? If so, it's
fallback content in the insertion point and would only render if Child was
not selected by IP1 so I'm not quite sure how the resulting event flow could
occur.

Right. In this case, SH2 is not used at all.


comment: 18
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c18
Hayato Ito wrote on 2013-11-28 02:04:34 +0000.

(In reply to Steve Orvell from comment #16)

(In reply to Hayato Ito from comment #9)

This might be a good opportunity to discuss how event path should be.

In the most strictest world, I don't think we should add either insertion
points, whether it's final destination or not

I would prefer this to the proposal here (only the last insertion point in
the path).

If insertion points are sometimes in the path, I worry that it will be too
confusing to know when they can be used and it will become an anti-pattern
to attach listeners there.

So my preferences in order are:

  1. all insertion points in event path.
  2. no insertion points in event path.
  3. last insertion point in event path.

Thank you. That means 2 is an acceptable proposal?

I wonder whether there is a missing piece of APIs or not in order to accept 2.

For example,

Need to perhaps change getDistributedNodes() handling a bit to make it
useful, since one should be able to observe changes to that list.

Adding an such event, like distributionChanged, would be useful to accept 2?


comment: 19
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c19
Olli Pettay wrote on 2013-11-28 16:05:00 +0000.

(In reply to Steve Orvell from comment #14)

fancy-list
SR


I know that fancy-decoration will show my list items and it looks nice so it
makes fancy-list better.

You should add listener to SR or somewhere, higher up in the propagation path.

Now I'm stuck because fancy-list unexpectedly stopped working. If I move the
event listener, it'll work, but do we really expect developers to understand
that they need to do this? This seems pretty arcane.
It is really really odd if developer needs to put listener to and putting the
listener to the parent wouldn't work.


comment: 20
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c20
Olli Pettay wrote on 2013-11-28 16:06:33 +0000.

(In reply to Steve Orvell from comment #15)

I'm not quite sure I follow this. Is SH2 a child of IP1? If so, it's
fallback content in the insertion point and would only render if Child was
not selected by IP1 so I'm not quite sure how the resulting event flow could
occur.

What has rendering to do with this all. We're talking about event dispatch ;)


comment: 21
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c21
Steve Orvell wrote on 2013-12-03 07:24:43 +0000.

(In reply to Olli Pettay from comment #20)

(In reply to Steve Orvell from comment #15)

I'm not quite sure I follow this. Is SH2 a child of IP1? If so, it's
fallback content in the insertion point and would only render if Child was
not selected by IP1 so I'm not quite sure how the resulting event flow could
occur.

What has rendering to do with this all. We're talking about event dispatch ;)

Yeah, that's fair. The key bit is that SH2 and Child1 cannot co-exist in the event path.

If the fallback content is not used, I think the event path is:

Child->IP1->SR1->SH1

If an event is fired on the fallback content:

(some distributed child of SH2)->IP2->SR2->SH2->IP1->SR1->SH1

Given this, I believe the event should never be able to bubble to the same insertion point more than once.


comment: 22
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c22
Olli Pettay wrote on 2013-12-03 07:42:34 +0000.

(In reply to Steve Orvell from comment #21)

If the fallback content is not used, I think the event path is:

Child->IP1->SR1->SH1
I'd like to understand what in the spec says this.

And whether or not an insertion point can be twice in the event path, event propagation
in event path is inconsistent with the rest of the DOM, and should be changed.
So far I haven't seen any real world use case which requires the current odd behavior.


comment: 23
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c23
Hayato Ito wrote on 2013-12-03 08:48:52 +0000.

(In reply to Olli Pettay from comment #22)

(In reply to Steve Orvell from comment #21)

If the fallback content is not used, I think the event path is:

Child->IP1->SR1->SH1
I'd like to understand what in the spec says this.

And whether or not an insertion point can be twice in the event path, event
propagation
in event path is inconsistent with the rest of the DOM, and should be
changed.
So far I haven't seen any real world use case which requires the current odd
behavior.

I'd like to know which current behavior is odd in order to make the discussion clear.

In my understanding:

A). In some shadow trees, an insertion point receives an event, but its parentNode doesn't receive an event. That's odd!

Is my understanding correct? Have you found any odd behavior other than A)?


comment: 24
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c24
Olli Pettay wrote on 2013-12-03 09:07:48 +0000.

(In reply to Hayato Ito from comment #23)

A). In some shadow trees, an insertion point receives an event, but its
parentNode doesn't receive an event. That's odd!
Yes. And that leads also to the odd behavior that sibling nodes may receive the same event.


comment: 25
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c25
Hayato Ito wrote on 2013-12-03 09:45:49 +0000.

(In reply to Olli Pettay from comment #24)

(In reply to Hayato Ito from comment #23)

A). In some shadow trees, an insertion point receives an event, but its
parentNode doesn't receive an event. That's odd!
Yes. And that leads also to the odd behavior that sibling nodes may receive
the same event.

Thank you.
Could you provide a reproduce case for sibling nodes? That's not what I expected.
I am afraid that I might miss something.


comment: 26
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c26
Olli Pettay wrote on 2013-12-03 10:07:56 +0000.

http://w3c.github.io/webcomponents/spec/shadow/#distribution-results
In the composed tree the second shadow host has insertion point as a child, but
also a shadow root. If event is dispatched to child1, both the
insertion point and shadow root get the event.


comment: 27
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c27
Hayato Ito wrote on 2013-12-04 03:44:19 +0000.

(In reply to Olli Pettay from comment #26)

http://w3c.github.io/webcomponents/spec/shadow/#distribution-results
In the composed tree the second shadow host has insertion point as a child,
but
also a shadow root. If event is dispatched to child1, both the
insertion point and shadow root get the event.

Okay. But in general, we don't have to treat a shadow root as a child of the shadow host. In event path, they might be adjacent to each other. But we should view them in separate trees. What I worry about is the odd behavior in the same node tree.


comment: 28
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c28
Hayato Ito wrote on 2013-12-04 04:14:26 +0000.

I think there is a confusion. So let me explain the design principle of the current event path.

  • An event can be dispatched across node trees.
  • If we view each node tree as a separate tree, there should be a certain level of consistency for the existing event dispatching model within the same node tree.

For example, given a fig4 (http://w3c.github.io/webcomponents/spec/shadow/index.html#distribution-results):

If child 1 is clicked, the event path would be:
[child1, IP1, IP3, IP3's parent, 2nd SR, 2nd SH, 1st SR, 1st SH, document]

For each node tree:

  • For the document tree, the event path would be [child1, 1st SH, document]
  • For 1st shadow tree, the event path would be [IP1, 2nd SH, 1st SR]
  • For 2nd shadow tree, the event path would be [IP3, IP3's parent, 2nd SR]

comment: 29
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c29
Olli Pettay wrote on 2013-12-04 06:31:16 +0000.

(In reply to Hayato Ito from comment #27)

(In reply to Olli Pettay from comment #26)

http://w3c.github.io/webcomponents/spec/shadow/#distribution-results
In the composed tree the second shadow host has insertion point as a child,
but
also a shadow root. If event is dispatched to child1, both the
insertion point and shadow root get the event.

Okay. But in general, we don't have to treat a shadow root as a child of the
shadow host.
That shadow host is a child of its parent node. And its parent node has an
insertion point as a child.

In event path, they might be adjacent to each other. But we

should view them in separate trees. What I worry about is the odd behavior
in the same node tree.


comment: 30
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c30
Olli Pettay wrote on 2013-12-04 06:40:44 +0000.

(In reply to Hayato Ito from comment #28)

I think there is a confusion.
I don't think so ;)

So let me explain the design principle of the

current event path.

  • An event can be dispatched across node trees.
  • If we view each node tree as a separate tree, there should be a certain
    level
    of consistency for the existing event dispatching model within the
    same node tree.

For example, given a fig4
(http://w3c.github.io/webcomponents/spec/shadow/index.html#distribution-
results):

If child 1 is clicked, the event path would be:
[child1, IP1, IP3, IP3's parent, 2nd SR, 2nd SH, 1st SR, 1st SH, document]

For each node tree:

  • For the document tree, the event path would be [child1, 1st SH, document]
  • For 1st shadow tree, the event path would be [IP1, 2nd SH, 1st SR]
  • For 2nd shadow tree, the event path would be [IP3, IP3's parent, 2nd SR]
    The example just happens to make that look nice.
    But if 1st shadow tree for example has a non-SH-node in the place of 2nd SH, and
    that node has 2nd SH as a child. Then for the 1st shadow tree the event path
    would be [IP1, 2nd SH, the-parent-of-2nd-SH, 2ns SR]

Now, the-parent-of-2nd-SH is the parent of both IP1 and 2nd SH, and event goes through both those siblings.


comment: 31
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c31
Hayato Ito wrote on 2013-12-04 07:01:43 +0000.

(In reply to Olli Pettay from comment #30)

(In reply to Hayato Ito from comment #28)

I think there is a confusion.
I don't think so ;)

So let me explain the design principle of the

current event path.

  • An event can be dispatched across node trees.
  • If we view each node tree as a separate tree, there should be a certain
    level
    of consistency for the existing event dispatching model within the
    same node tree.

For example, given a fig4
(http://w3c.github.io/webcomponents/spec/shadow/index.html#distribution-
results):

If child 1 is clicked, the event path would be:
[child1, IP1, IP3, IP3's parent, 2nd SR, 2nd SH, 1st SR, 1st SH, document]

For each node tree:

  • For the document tree, the event path would be [child1, 1st SH, document]
  • For 1st shadow tree, the event path would be [IP1, 2nd SH, 1st SR]
  • For 2nd shadow tree, the event path would be [IP3, IP3's parent, 2nd SR]
    The example just happens to make that look nice.
    But if 1st shadow tree for example has a non-SH-node in the place of 2nd SH,
    and
    that node has 2nd SH as a child. Then for the 1st shadow tree the event path
    would be [IP1, 2nd SH, the-parent-of-2nd-SH, 2ns SR]

Now, the-parent-of-2nd-SH is the parent of both IP1 and 2nd SH, and event
goes through both those siblings.

Thank you for the explanation! But I still think this is the root cause of the confusion. :)

that node has 2nd SH as a child. Then for the 1st shadow tree the event path

In this case, IP3 cannot select nodes which are distributed into IP1.
Because IP1 is not a child node of 2nd SH.
That means CHILD1's destination insertion point is [IP1], rather than [IP1, IP3].


comment: 32
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c32
Olli Pettay wrote on 2013-12-10 12:22:27 +0000.

(In reply to Olli Pettay from comment #22)

that node has 2nd SH as a child. Then for the 1st shadow tree the event path

In this case, IP3 cannot select nodes which are distributed into IP1.
Because IP1 is not a child node of 2nd SH.
That means CHILD1's destination insertion point is [IP1], rather than [IP1,
IP3].

Hmm, was my example wrong. Trying to find a better example.

Anyhow, there is still no example where non-final-destination insertion
points are needed in the event path and since this makes event propagation
inconsistent with the rest to the platform, there is no need to make this
special case.


comment: 33
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c33
Hayato Ito wrote on 2013-12-10 13:25:17 +0000.

(In reply to Olli Pettay from comment #32)

(In reply to Olli Pettay from comment #22)

that node has 2nd SH as a child. Then for the 1st shadow tree the event path

In this case, IP3 cannot select nodes which are distributed into IP1.
Because IP1 is not a child node of 2nd SH.
That means CHILD1's destination insertion point is [IP1], rather than [IP1,
IP3].

Hmm, was my example wrong. Trying to find a better example.

Yeah, it might be better to have a better example.
Especially, I am curious whether we can create an example which hits the following case A):

A). In some shadow trees, an insertion point receives an event, but its parentNode doesn't receive an event. That's odd!

If we can create an example which causes A), I think it might be worth to fix the current spec.

Anyhow, there is still no example where non-final-destination insertion
points are needed in the event path and since this makes event propagation
inconsistent with the rest to the platform, there is no need to make this
special case.


comment: 34
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c34
Olli Pettay wrote on 2013-12-10 13:51:31 +0000.

Actually, the more I think this issue, the less I understand why we need
any insertion points in the event path.
All we need is the parent of the final destination insertion point
then propagate event there through shadow boundaries up to the non-shadow dom.

One can always add listeners to shadow host or to the distributed node.
(XBL1 adds listeners by default to the bound element == shadow host)


comment: 35
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c35
Hayato Ito wrote on 2013-12-10 13:59:28 +0000.

(In reply to Olli Pettay from comment #34)

Actually, the more I think this issue, the less I understand why we need
any insertion points in the event path.
All we need is the parent of the final destination insertion point
then propagate event there through shadow boundaries up to the non-shadow
dom.

One can always add listeners to shadow host or to the distributed node.
(XBL1 adds listeners by default to the bound element == shadow host)

Thank you. That's (2) in the following list.

  1. all insertion points in event path.
  2. no insertion points in event path.
  3. last insertion point in event path.

If we can get rid of (3) from this list, we must choose (1) or (2). The current spec is (1).

My opinion for (2) is comment #18.
https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c18


comment: 36
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c36
Olli Pettay wrote on 2013-12-10 14:06:16 +0000.

yeah, and I don't understand why the complicated (1) is chosen.

distributionChanged event might be useful, but probably not needed.
One can always just add listeners to the host.
And distributionChanged could be added later if needed.


comment: 37
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c37
Hayato Ito wrote on 2013-12-16 07:36:48 +0000.

(In reply to Olli Pettay from comment #36)

yeah, and I don't understand why the complicated (1) is chosen.

distributionChanged event might be useful, but probably not needed.
One can always just add listeners to the host.
And distributionChanged could be added later if needed.

I'd like to hear a opinion from Steve.

I agree that (1) is complicated than (2), but (1) doesn't break the original claim in comment #1, does that?

To not break consistency with normal DOM where if a node is in
event path,

I think we have to find a balance. (1) is complicated, but (1) gives developers more power.


comment: 38
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c38
Olli Pettay wrote on 2013-12-16 12:34:40 +0000.

(In reply to Hayato Ito from comment #37)

I think we have to find a balance. (1) is complicated, but (1) gives
developers more power.

What more power? Event listener can always be added to the distributed nodes
or to their parent.
We should not add complicated stuff without good use cases.


comment: 39
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c39
Steve Orvell wrote on 2013-12-16 17:27:02 +0000.

Removing insertion points from the event path is a significant change. I think it's important to try to gather more feedback before moving forward.

One obvious issue I see is that to capture the same behavior there are some cases where additional 'wrapper' elements will be required, e.g.

<content select=".header"></content>
<content select=".content"></content>

With the current rules, I can listen to events that bubble from elements selected into each insertion point via listeners on the content element. If we remove insertion points from the event path, one would need wrapper elements around the insertion points with the listeners on them.


comment: 40
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c40
Olli Pettay wrote on 2013-12-16 17:34:05 +0000.

Why? Add a listener to the shadow host? You can easily filter out events in the listener, for example by using the content.getDistributedNodes().

Or you can add listeners to the distributed nodes themselves.


comment: 41
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c41
Steve Orvell wrote on 2013-12-16 18:15:15 +0000.

Sure, that's another option. In either case, the developer must do more work to get the desired behavior.


comment: 42
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c42
Hayato Ito wrote on 2013-12-17 03:26:50 +0000.

My biggest concern about removing insertion point from the event path is whether it would cause developers a kind of burden or not.

We need more feedbacks.

  1. all insertion points in event path.
  2. no insertion points in event path.
  3. last insertion point in event path.

My understanding between (1) and (2) is:

By (1):
For each node tree:

  • For the document tree, the event path would be [child1, 1st SH, document]
  • For 1st shadow tree, the event path would be [IP1, 2nd SH, 1st SR]
  • For 2nd shadow tree, the event path would be [IP3, IP3's parent, 2nd SR]

By (2):
For each node tree:

  • For the document tree, the event path would be [child1, 1st SH, document]
  • For 1st shadow tree, the event path would be [2nd SH, 1st SR]
  • For 2nd shadow tree, the event path would be [IP3's parent, 2nd SR]

Although I don't have a strong opinion whether which, (1) or (2) is better, I am still not convinced that (2) is much better than (1). So far, I think (1) is more useful for developers than (2).


comment: 43
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c43
Steve Orvell wrote on 2014-02-26 03:20:46 +0000.

Let's go back to this case in https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c39 and review the counter-argument.

<content select=".header"></content>
<content select=".content"></content>

Why? Add a listener to the shadow host? You can easily filter out events in the
listener, for example by using the content.getDistributedNodes().
Or you can add listeners to the distributed nodes themselves.

Neither option is acceptable.

If a listener is added to the shadowRoot, then each handler must start at event.target and walk up the tree checking if the element is in the specific content's list of distributed nodes. This has a non-trivial cost in code and performance.

Alternatively, if handlers are attached to the distributed nodes, there's no good way today for the developer to respond to nodes that are added/removed. You can watch for mutations on the host's childList, but you will not see elements that are re-projected this way.

At this point, I don't see an alternative to requiring all insertion points to be in the event path. If we don't include insertion points, we run into the problems listed above. If we include only the last insertion point, we have composition fail.


comment: 44
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c44
Hayato Ito wrote on 2014-03-10 08:12:55 +0000.

Thank you for the explanation, Steve.

Is there any comments about this?

If we don't have any further objection to the current spec, let me close this bug in a week.
Remember that we can re-open this bug anytime if we feel to discuss this topic again.


comment: 45
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c45
Hayato Ito wrote on 2014-03-10 08:15:22 +0000.

Because I am cleaning up the bugs, I might close this bug in a few days. Please feel free to re-open this if you need further discussion.


comment: 46
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c46
Olli Pettay wrote on 2014-03-21 16:57:32 +0000.

Uh, I didn't get bugmail about this.
Reading comments and possibly reopening...
I'm not happy shadow dom adding bizarre event propagation paths.


comment: 47
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c47
Olli Pettay wrote on 2014-03-21 17:08:16 +0000.

(In reply to Steve Orvell from comment #43)

Let's go back to this case in
https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c39 and review the
counter-argument.

<content select=".header"></content>
<content select=".content"></content>

Why? Add a listener to the shadow host? You can easily filter out events in the
listener, for example by using the content.getDistributedNodes().
Or you can add listeners to the distributed nodes themselves.

Neither option is acceptable.

If a listener is added to the shadowRoot, then each handler must start at
event.target and walk up the tree checking if the element is in the specific
content's list of distributed nodes. This has a non-trivial cost in code and
performance.
Making propagation path more complicated has also performance cost, and
makes event propagation inconsistent.
Also, it is rather trivial cost in code, and makes code less unexpected, since
propagation path doesn't have inconsistencies.

Alternatively, if handlers are attached to the distributed nodes, there's no
good way today for the developer to respond to nodes that are added/removed.
You can watch for mutations on the host's childList, but you will not see
elements that are re-projected this way.
Which is why I suggested making getDistributedNodes more useful. As of now it is rather
dummy plain list, but one should be able to get notification when it has been changed.

At this point, I don't see an alternative to requiring all insertion points
to be in the event path. If we don't include insertion points, we run into
the problems listed above. If we include only the last insertion point, we
have composition fail.

XBL1 has the long tradition to put listener to the binding parent (shadowroot),
and that hasn't been a perf problem.


comment: 48
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c48
Olli Pettay wrote on 2014-03-21 17:22:48 +0000.

(In reply to Steve Orvell from comment #43)

Neither option is acceptable.

If a listener is added to the shadowRoot, then each handler must start at
event.target and walk up the tree checking if the element is in the specific
content's list of distributed nodes. This has a non-trivial cost in code and
performance.
In other words, is there any real world use case when this would be a
performance issue enough to warrant to inconsistent propagation path.
(inconsistencies make code harder to read and understand, and error prone.)


comment: 49
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c49
Steve Orvell wrote on 2014-03-21 21:34:40 +0000.

I'm ok with eliminating insertion points from the event path.

We shouldn't include just the final one because, as discussed, this doesn't support composition.

I still do think it would be better to have all the insertion points in the event path to support the cases mentioned previously. However, these cases feel uncommon to me. Most of the time, there is going to be a convenient node around the insertion point on which to hang the listener.


comment: 50
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c50
Boris Zbarsky wrote on 2014-03-21 21:39:10 +0000.

I would like to clarify what the expected behavior is here, at least in the simple case.

Say the light DOM looks like this:

The

has a shadow DOM like so (I'm going to give the shadow root an ID, though I realize it's not an element; that's just for ease of referring to it):

and the

has a shadow DOM like so:

Now an event is fired at

. In the composed tree, the parent chain looks like 3, 2, 9, 6, 5, 1, I believe.

If I am following the algorithm at http://w3c.github.io/webcomponents/spec/shadow/#event-paths correctly, we start with the event path being [3, 2], then we see that the destination insertion points of

is not empty and that none of them are shadow insertion points, so we set the path to [3, 2, 7, 10](note that the order of the insertion points here is "rootmost first", unlike normal event path behavior).

Now we start off at the and start walking the parent chain. We add "9" to the path, then we add "8" to the path. Then CURRENT is a shadow root, so we skip to its shadow host, which is "6". We keep walking: "5", "4", skip to "1". So the final path is:

3,2,7,10,9,8,6,5,4,1

I have ignored for now issues dealing with multiple shadow trees and whatever scenario comment 13 is talking about.

I have confirmed that in the above simple testcase Chrome in fact has the event path I just described.

What I don't quite understand, if we posit that we do want to put all the insertion points in the path, is why the path is not the somewhat more intuitive:

3,2,10,9,8,7,6,5,4,1

?


comment: 51
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c51
Boris Zbarsky wrote on 2014-03-21 21:39:31 +0000.

Created attachment 1457
Simple testcase


comment: 52
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c52
Dimitri Glazkov wrote on 2014-03-21 22:19:31 +0000.

(In reply to Boris Zbarsky from comment #50)

Thanks for the test case -- I turned it into a jsbin:
http://jsbin.com/newir/1/edit

What I don't quite understand, if we posit that we do want to put all the
insertion points in the path, is why the path is not the somewhat more
intuitive:

3,2,10,9,8,7,6,5,4,1

Here's how the reasoning works. Since insertion points aren't in the composed tree, but are in event path, we have to come up with a mental model of how they are added.

Here's the mental model that the spec ascribes:

During distribution, first 2 is distributed into insertion point 7. So the path is now 3,2,7.

Then, the result of that distributed into 10, so the path is now 3,2,7,10.

In other words, the spec follows the distribution sequence and builds the path accordingly.

FWIW, I am fine for insertion points to not receive any events. I'll be sad about it for a day, and then I'll get over it.


comment: 53
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c53
Dimitri Glazkov wrote on 2014-03-21 22:40:38 +0000.

The desired property here is composition symmetry. If you group chunks of the path by trees (let's mark them as 1, 2, and 3), you get:

1:[3,2] 2:[7] 3:[10,9,8] 2:[6,5,4] 1:1

Notice how if I only had trees 2 and 3 (for example, I am an author of a component that created shadowroot#4), I have a view into the contiguous fragment of the same event path:

2:[7] 3:[10,9,8] 2:[6,5,4]

Similarly, if the main document turns out to be not a document at all, but just another shadow root, and we add insertion point in it, its inner event path will not change, only the outer parts of it will. Which means that the authors of components don't have to worry about how the composition affects them.


comment: 54
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c54
Dimitri Glazkov wrote on 2014-03-21 23:47:42 +0000.

(In reply to Olli Pettay from comment #47)

(In reply to Steve Orvell from comment #43)

Let's go back to this case in
https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c39 and review the
counter-argument.

<content select=".header"></content>
<content select=".content"></content>

Why? Add a listener to the shadow host? You can easily filter out events in the
listener, for example by using the content.getDistributedNodes().
Or you can add listeners to the distributed nodes themselves.

Neither option is acceptable.

If a listener is added to the shadowRoot, then each handler must start at
event.target and walk up the tree checking if the element is in the specific
content's list of distributed nodes. This has a non-trivial cost in code and
performance.
Making propagation path more complicated has also performance cost, and
makes event propagation inconsistent.

I agree on this point. The key here is deciding whether we should carry this burden as a platform or pass it on to developers.

Also, it is rather trivial cost in code, and makes code less unexpected,
since
propagation path doesn't have inconsistencies.

A good general exercise here is to assume that each shadow root chunk is written by different people at different times. As a rule, these developers should not need to have any insight into how these chunks are composed. In other words, if I as a developer have to defensively anticipate what will happen outside of my shadow tree, we failed the main objective of this whole shadow DOM exercise -- composition.

Having all insertion points included in the event path satisfies this constraint very well. As a developer, I have a consistent, simple way to find out what events are being dispatched in the parts of the outer tree that are distributed to my insertion points.

Having no insertion points included in the event path also satisfies this constraint, and it's pretty clear that our guinea pig developer (Steve) already worked around this problem by simply putting a div around the insertion point.

Having only final insertion point included in event path is craziness, because now I, as a developer of my component may or may not receive an event depending on how some other dude/dudette composed it in their app. That's composition fail.

So, to keep on moving, we should just zap the insertion points altogether from the event path.


comment: 55
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c55
Boris Zbarsky wrote on 2014-03-22 00:43:49 +0000.

I think the difference in mental model here is in whether insertion points get redistributed themselves or not. So where you came up with:

1:[3,2] 2:[7] 3:[10,9,8] 2:[6,5,4] 1:1

I had come up with:

1:[3,2] 3:[10,9,8] 2:[7,6,5,4] 1:1

based on the staying put when redistribution into 10 happens.

So in my mental model, you distribute stuff into an insertion point, then you make the insertion point go away, hoisting its kids up to be kids of its parent, then you look for shadow trees attached to that parent. But in your model it sounds like you distribute stuff into the insertion point, then you look for shadow trees attached to its parent and distribute the entire insertion point into those as needed, and then you hoist things out of insertion points. At least if I understand your model correctly

I think my model makes a lot more sense when thinking about what happens when 10 only accepts some of the kids of 6. At that point it becomes clear that 7 itself is not actually being distributed under 10...


comment: 56
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c56
Boris Zbarsky wrote on 2014-03-22 00:47:53 +0000.

I guess we're no longer using this stuff for CSS inheritance at least (if I read http://dev.w3.org/csswg/css-scoping/#inheritance right), so we can just worry about the event behavior...


comment: 57
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c57
Jonas Sicking wrote on 2014-03-22 04:17:52 +0000.

First off, I think we should look at this from the point of view of use cases.

What is the use case for adding an event listener to an insertion point? A user can't ever click an insertion point because they are not rendered.

However it does seem nice and intuitive if an event listener attached to an insertion point ends up receiving events targetted at any of the nodes inserted into that insertion point. As well as those nodes descendants of course.

And for the sake of consistency, this should always happen, no matter if there is shadow DOM attached to the parent of the insertion point or not. And no matter if there is shadow DOM attached to one of the nodes inserted into that insertion point.

Assuming that we can do this without creating large performance problems, and without creating too weird edge cases, do people agree that this is a laudable goal?

So I read comment 50 and also ended up with the same question as bz. Why not the more intuitive propagation path of 3,2,10,9,8,7,6,5,4,1?

So I started writing a comment why Dimitri's logic in comment 52 didn't make sense.

And instead writing the logic that would lead to bz's intuitive propagation path in comment 50 (3,2,10,9,8,7,6,5,4,1).

However I realized that I couldn't come up with a logical set of rules that would lead to that path.

While it seems to make sense to have that come before the , I couldn't motivate why that should be.

And, more importantly, it only seems to make sense if the '7' insertion point is an immediate child of the '6' shadow host. Let's insert an element between the '6' and the '7' nodes, such that we get the following tree:

In this case no node is inserted into multiple insertion points, which makes the whole thing much simpler. The '2' node is inserted into the '7' insertion point, and the 'a' node is inserted into the '10' insertion point.

In this case it's pretty clear that an event fired at the '3' node would get a propagation path of 3,2,7,a,10,9,8,6,5,4,1

So it makes sense to me that if you simply remove the 'a' and insert the '7' directly into the '6', that you'd get the same propagation path but with the 'a' removed. I.e. 3,2,7,a,10,9,8,6,5,4,1

I've read through the initial comments in this bug but I don't see the inconsistencies that are being discussed there. I.e. all of the following appears true:

  • No node ever receives the same event twice.
  • Any time an event reaches a node, it also reaches the node's parent.
  • During the capturing phase, a node always receives an event before its children.
  • During the bubbling phase, a node always receives an event after its children.
  • The only way to receive an event multiple times in the same shadow tree is by
    registering listeners on multiple nodes, where some of the nodes are ancestors of
    other nodes.

All of the above appears to be true both both with and without the shadow DOM spec.

The only way that I can see that you could receive the same event multiple times is if you register event listeners in multiple different shadow trees. In that case it doesn't seem surprising that you can receive an event multiple times. It's something that happens even in the very simple event model that XBL1 uses.

Is the above wrong? Or is there some other inconsistency that I'm missing? Or is the concern about performance at this point?

Examples would be very helpful.


comment: 58
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c58
Jonas Sicking wrote on 2014-03-22 04:31:38 +0000.

For what it's worth, if I create a tree which illustrates how event propagation happens using the currently defined event path, and the example at 1 I get something like this:

1 http://w3c.github.io/webcomponents/spec/shadow/#distribution-results


comment: 59
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c59
Olli Pettay wrote on 2014-03-22 13:34:25 +0000.

(In reply to Jonas Sicking from comment #57)

Is the above wrong? Or is there some other inconsistency that I'm missing?
Or is the concern about performance at this point?

The inconsistency comes from the non-linear event propagation path in the
final flattened tree.


comment: 60
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c60
Olli Pettay wrote on 2014-03-22 14:18:27 +0000.

(In reply to Dimitri Glazkov from comment #54)

So, to keep on moving, we should just zap the insertion points altogether
from the event path.

This would be fine to me. A lot less surprising propagation path.


comment: 61
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c61
Boris Zbarsky wrote on 2014-03-22 15:01:14 +0000.

non-linear event propagation path in the final flattened tree.

I'm still thinking about Jonas' example, but do you mind explaining clearly the issue here? At least in my simple example, the nodes in the final flattened tree (so ignoring the insertion points and shadow roots, which are not present in the flattened tree) see the event in the order 3,2,9,6,5,1, which seems like the expected order...


comment: 62
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c62
Olli Pettay wrote on 2014-03-22 16:26:42 +0000.

Created attachment 1458
example

This shows a case when dispatching two events ends up creating
a diamond shape, because the first insertion point is cherry picked form the
flattened tree to the next item in the propagation path after the target.
Such behavior is really odd when we otherwise operate on trees and lists.
(And in my mind insertion points are there in the flattened tree. Otherwise events couldn't go through them at all.
But it is actually not a Shadow DOM terminology.)

DOM:

[click me 1] [click me 2]

attached to sh1:




attached to sh2:



propagation paths are

  • SPAN[id=s1], CONTENT[id=ip1], CONTENT[id=ip2.1], SPAN[id=sh2], DIV[id=sh1]
  • SPAN[id=s2], CONTENT[id=ip1], CONTENT[id=ip2.2], SPAN[id=sh2], DIV[id=sh1]

comment: 63
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c63
Olli Pettay wrote on 2014-03-22 17:00:48 +0000.

In other words, atm union of two event paths is a tree.
You can rely on that if there is a target T in the path, the next
target T' in the path is always the same for event type foo.


comment: 64
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c64
Jonas Sicking wrote on 2014-03-22 17:45:04 +0000.

Ah, I think I see the issue indeed.

In Olli's example the "tree" that the DOM events code sees is this (I took the liberty of adding id's to the shadowroots for clarity):

[click me 1] [click me 2]

Note that the node shows up twice!

I.e. if you fire an event on s1 the event path is
s1,ip1,ip2.1,sr2,sh2,sr1,sh1

And if you fire an event on s2 the event path is
s2,ip1,ip2.2,sr2,sh1,sr1,sh1

I.e. in both cases does the event go through ip1 (which is expected given that both s1 and s2 are inserted into ip1), but ip1's parent is different in the two events.

I'm curious, what does the spec say the event path is if you target an event on the ip1 node? Or on insertion points in general?

I still don't feel convinced either way of what the right thing to do here is.

I don't think including just the innermost insertion point is a good solution since it introduces other types of inconsistencies. I.e. it would mean that adding a shadow DOM to sh1 means that suddenly ip1 doesn't see any events. This will prevent any type of encapsulation.

And preventing any and all events to go through insertion points seems like breaking a useful feature.


comment: 65
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c65
Olli Pettay wrote on 2014-03-22 18:11:26 +0000.

It is probably best to not add any insertion points to the path.

You can add listener to the shadow host, or to the parent of the insertion point
or to the child nodes of shadow host or only to those child nodes which
are currently distributed to insertion point etc.
That gives already plenty of flexibility without need to change
event path creation significantly.


comment: 66
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c66
Dimitri Glazkov wrote on 2014-03-23 16:02:54 +0000.

I turned Olli's snippet into the jsbin here: http://jsbin.com/gakid/1/edit

I added the wrapper around ip2.*, and Steve's workaround works well there. It doesn't work as well around ip1, since that makes ip1 a grandchild of sh2. In that particular case, I can listen to the shadow root and get the same result...

I am almost sure that the wrapper workaround is a reasonable solution, but I need to play with this some more.


comment: 67
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c67
Hayato Ito wrote on 2014-03-24 04:50:29 +0000.

Thank you for all guys for comments for the event path.

I am feeling that I have to explain the background of the current event path calculation algorithms and the rationale of that.
I've designed the current event path algorithms so that we can achieve the following goal:

Objective A) In each node tree (forget other node trees), the event path should be a linear path.

That means:

  • If a node on the event path has the parent node in the node tree, the parent node should also be on the event path. Only exception is the root node of a node tree.
  • In each node tree, the child node must come before its parent node on the event path.

From the view of developers whose concern is only one node tree where they live, they see the behavior of the event path doesn't change at all as long as their concern is one node tree. They shouldn't care of other node trees.

The following is not the goal of the current algorithm:

Objective B) Define a reasonable total order between nodes which are in different node trees on the same event path.

I'd like to point out the following fact because I guess every one here doesn't notice this fact:

  • Think about a tree of trees. Node trees that are involved in one even path can form a tree of node trees. Node trees can't be linear here.

I suggest you guys to think about this fact carefully. You can easily create this case by modifying the example in comment #50 as follows:

  • Make

    a shadow host and let it host the following shadow tree.

In this case:

  • Event path will be [3, 2, 7, 10, 9, 8, 6, 13, 12, 11, 5, 4, 1].
  • There are 4 node trees which are involved in this event path.
  • A node tree whose root node is #4 have two child node trees, a node tree whose root node is #8 and a node tree whose root node is #11.

It'd be difficult to define a reasonable total order between nodes in this case. Can you define a reasonable total order in this case?
DFS pre-oder? BFS-post-order? Neither can be a reason strong enough to abandon the current simple one-pass algorithm.
That's the reason why objective B) is not the goal.

The current algorithm uses one-pass algorithm and can achieve the objective A) at the same time.
I think simple one-pass algorithm is important here for the efficiency.

I'm not saying that we should include insertion points in the event path. That's orthogonal.

However, comment #63 can't be a strong reason not to include insertion points because the claim of 'union of two event paths is a tree' is not correct according to the current spec.
The current spec doesn't define one super node tree, which are composed of nodes which participate in a node tree in the same tree of trees.

The spec doesn't define ancestor/descendant relationships between nodes if they are in different node trees. That's intentional.

That means a tree used in 'union of two event paths is a tree' can't have a clear definition. Nodes in different node trees can't be a tree.
They live in separated worlds and should be considered as disconnected.

One more thing:

If we would exclude all insertion points from event path, we must have exceptional rule for insertion points which have fallback elements.

Example:

In this case, event path for "#n4" can't be [n4, n2, n1]. That should be [n4, n3, n2, n1]. We have to have an exceptional rule.


comment: 68
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c68
Hayato Ito wrote on 2014-03-24 05:49:48 +0000.

As I mentioned that in comment #9, I'd like to note the following again:

If we exclude all shadow roots and insertion points from the current event path, the event path will be equivalent with "inclusive ancestors of the target node in the composed tree" with the following exceptional cases:

  • The target node itself is an insertion point.
  • If fallback elements are distributed to a insertion point, we must include the insertion points to the event path so that we can achieve objective A).

comment: 69
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c69
Dimitri Glazkov wrote on 2014-03-25 16:16:52 +0000.

Thank you so much for explaining the design goals, Hayato-san!

It was illuminating for me. I'd forgotten about the fallback content in insertion points.


comment: 70
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c70
Jonas Sicking wrote on 2014-03-26 22:34:05 +0000.

I agree with comment 67 and comment 68. Order within a tree is much more important than order between nodes in different trees.

And in comment 50 bz also suggests an event path where the total order of nodes is arguably "non-sensical" since it jumps back and forth between two trees.

I'd even argue that the order of the non-insertion-point nodes makes a lot of sense as it's currently defined by spec since it matches rendering order. This means that if you click an icon inside a button inside a toolback that the event goes first to the icon, then the button then the toolbar as it's bubbling out. Even if the nodes are spread out over multiple shadow DOM trees.

I don't see a way to accomplish that if we also want to have a simple total order between nodes?

That said, it's still not clear to me what the right answer is on the topic of when/if to fire events on insertion points.

I do quite like the current feature that you can listen on an insertion point to get notified about all the events that are inserted in that insertion point. And it feels quite intuitive for authors that that is the case.

While you can generally wrap a around the insertion point and add your listeners there, that can affect rendering. For example if some of the nodes involved in the rendering are rendered as tables/tablecells/tablerows.

It also will affect nested insertion points if the parent of the insertion point that you are wrapping has a binding. Now it's the span that will get distributed rather than all the nodes that were inserted in the insertion point.


comment: 71
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c71
Dimitri Glazkov wrote on 2014-03-27 16:18:13 +0000.

(In reply to Jonas Sicking from comment #70)

I don't see a way to accomplish that if we also want to have a simple total
order between nodes?

That said, it's still not clear to me what the right answer is on the topic
of when/if to fire events on insertion points.

Maybe we can resolve this if we reduce the overall problem to this question: is introducing more complex total order in event path net positive or net negative?

Cons:

  • increased complexity
  • (please add more)

Pros:

  • more intuitive for the consumer localized to any given tree
  • useful to listen for events coming out of elements, distributed to insertion points
  • fallback content is handled consistently

comment: 72
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c72
Olli Pettay wrote on 2014-03-27 17:19:28 +0000.

(In reply to Dimitri Glazkov from comment #71)

Cons:

  • increased complexity
    Slower event dispatch since event target chain creation becomes
    more complicated because ... see the next point
  • (please add more)
    Inconsistent targeting from target T to T' in the event target chain,
    which makes event dispatch less intuitive when one needs to think about the
    whole event dispatch, not only local shadow tree.
    And because of .stop*Propagation() for example one needs to think about the whole
    path in some cases, not only local parts. Same with default handling. If you use in the
    shadow trees and click somewhere, which link to follow? The first shadow tree
    can affect to the behavior of the nested shadow trees.

Pros:

  • more intuitive for the consumer localized to any given tree
  • useful to listen for events coming out of elements, distributed to
    insertion points
  • fallback content is handled consistently

(I'm not saying pros aren't pros)

I guess XBL1 doesn't have this problem since it doesn't have explicit insertion points,
so event propagation follows always the natural path.


comment: 73
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c73
Jonas Sicking wrote on 2014-03-27 17:59:28 +0000.

XBL1 these days do have explicit insertion points. I.e. we leave the insertion points in the tree. The reason XBL1 doesn't have this problem simply because it optimizes simplicity over usefulness.

For example, if you have an XBL1 binding for a button that looks like

<-- xbl1 equivalent of shadowroot, sort of

<-- xbl1 equivalent of

And content like:

text here

then clicking on the icon or the text in the button does not fire any events in the XBL1 shadow content at all. However if you click a few pixels away so that you hit the borders added by the two divs now the event does fire on the shadow content.

From an author point of view this is arguably very inconsistent. Normally with the DOM, it doesn't matter if the user clicks on the border of an element, or on any of the elements inside it. This makes a lot of sense from a UI point of view too when it comes to things like click events.

However with XBL1 that model is broken and if you want to implement a UI widget that has insertion points you are basically out of luck when it comes to catching all UI actions inside your widget as I can tell.

You could overlay any inserted content with absolutely positioned elements, but that means that those events don't reach the content inside the insertion point that the user clicked which is really bad too.

So while XBL1 is simple implementation-wise, it seems to me that it creates a lot of complexity for authors.

Or am I misremembering the XBL1 event model?


comment: 74
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c74
Olli Pettay wrote on 2014-03-27 18:25:30 +0000.

(In reply to Jonas Sicking from comment #73)

XBL1 these days do have explicit insertion points.
Oh, right, the recent change to make anonymous content to look more like
shadow dom.
I'm talking about the classical xbl1 which Gecko had for 10+ years

then clicking on the icon or the text in the button does not fire any events
in the XBL1 shadow content at all.
Yes it does. Event propagates to the insertion point.


comment: 75
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c75
Boris Zbarsky wrote on 2014-03-27 19:07:16 +0000.

In XBL1, the event path is just along the composed tree.


comment: 76
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c76
Jonas Sicking wrote on 2014-03-27 19:38:24 +0000.

So then XBL1 also has exact same the complex weaving of nodes from different trees. I.e. the event path for "normal" (non-insertion-point, non-shadow-root) nodes is the same for XBL1 and shadow DOM.

So it sounds like we're back to that the remaining question to solve is if we should have insertion points in the event path or not? Or is there other things too?

I guess we could also argue over if the shadow-root should be in the event path or not, but I don't see any disadvantages of having it in the event path, and don't think I've seen anyone in here argue that it shouldn't be in the event path. Or did I miss that?

I agree that if you look at the event path across different events and across different disconnected trees, then keeping insertion points in the event path creates a more complex understanding.

However reasoning about the order of events within a single tree, even when looking across multiple different events, is still quite simple. I.e. it's no different from normal DOM event propagation (again, unless I'm missing something).

And if you look at the order of events across multiple trees, then you'll always see a somewhat complex view, even in XBL1. But it definitely gets more complex when you have insertion points in there too.

So the question is, does the ability to listen to events from nodes inserted into an insertion point warrant that extra complexity?


comment: 77
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c77
Olli Pettay wrote on 2014-03-27 20:25:44 +0000.

(In reply to Jonas Sicking from comment #76)

So then XBL1 also has exact same the complex weaving of nodes from different
trees.
No. In XBL if you have target T, the next target in the chain is always T'


comment: 78
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c78
Hayato Ito wrote on 2014-03-28 04:25:50 +0000.

(In reply to Jonas Sicking from comment #76)

I guess we could also argue over if the shadow-root should be in the event
path or not, but I don't see any disadvantages of having it in the event
path, and don't think I've seen anyone in here argue that it shouldn't be in
the event path. Or did I miss that?

Good point. I've thought it too.

My comment,

If we exclude all shadow roots and insertion points from the current event path, the event path will be equivalent with "inclusive ancestors of the target node in the composed tree.

implies that. :)

If we remove insertion points, we might want to remove shadow roots too from the event path.

I'm not saying that we should remove insertion points (and shadow roots) from the event path.
I still don't see a strong disadvantage of having these in the event path.

So the question is, does the ability to listen to events from nodes inserted
into an insertion point warrant that extra complexity?

I've seen 'extra complexity' of having insertion points in even path several times in this discussion.
However, I'd like to figure out a real issue what this complexity would cause.

From the experience of implementing the event path in blink, this didn't cause any extra burden for implementors.

Therefore, I'd like to know what is a real issue for web developers by having insertion points in the event path.
From the discussion, it looks the advantages outweigh the disadvantages, if exists, for web developers.

I'd like to note that the original motivation of including insertion points in the event path is we thought it's useful for web developers.


comment: 79
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c79
Hayato Ito wrote on 2014-03-28 04:32:46 +0000.

(In reply to Hayato Ito from comment #78)

From the experience of implementing the event path in blink, this didn't
cause any extra burden for implementors.

I'm not saying that this will apply to all user-agent's implementations.
I'd like to share my experience in blink, hoping it might be useful for the discussion.


comment: 80
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c80
Jonas Sicking wrote on 2014-03-28 05:52:39 +0000.

So then XBL1 also has exact same the complex weaving of nodes from different
trees.
No. In XBL if you have target T, the next target in the chain is always T'

I was referring to "normal" nodes here. Both XBL1 and Shadow DOM alternates "normal" nodes from different shadow trees in the event path. I thought this was one of the sources of complexity that you were worried about, but it appears that I misunderstood?

So it indeed then seems like the only contentious part here is weather to include insertion points in the event path or not.


comment: 81
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c81
Olli Pettay wrote on 2014-03-28 11:12:42 +0000.

(In reply to Hayato Ito from comment #79)

I'm not saying that this will apply to all user-agent's implementations.
I'd like to share my experience in blink, hoping it might be useful for the
discussion.
(IIRC when shadow dom event dispatch was added to webkit/blink, its
event dispatch speed regressed significantly. At least there was a time
when doing perf testing I noticed chrome's event dispatch speed regressed quite a bit)
It wouldn't be an implementation issue for Gecko, but perf would regress a bit.


comment: 82
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c82
Olli Pettay wrote on 2014-03-28 11:27:22 +0000.

The setup the spec has oddly prioritizes top most shadow trees over the
nested ones.
Using https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c62 as an example.
if p1.onclick = function(e) { e.stopPropagation(); }, then nothing
in the shadow tree 2 will see the event during bubble phase.
And since shadow tree 1 is there first also during capture phase,
p1.parentNode.addEventListener("click", function(e) { e.stopPropagation() }, true); would also prevent shadow tree 2 to see the event.
Why the shadow tree which has the final insertion has lower priority than
the first shadow tree?

And yet default handling doesn't have the same setup.
If you have elements in shadow tree 1 and in shadow tree 2, default
handling goes via the deepest most first, not the one in shadow tree 1.

(There are so many cases which just start to behave oddly when event path
doesn't follow the normal descendant->ancestor path)


comment: 83
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c83
Dimitri Glazkov wrote on 2014-03-28 18:13:01 +0000.

(In reply to Olli Pettay from comment #81)

(In reply to Hayato Ito from comment #79)

I'm not saying that this will apply to all user-agent's implementations.
I'd like to share my experience in blink, hoping it might be useful for the
discussion.
(IIRC when shadow dom event dispatch was added to webkit/blink, its
event dispatch speed regressed significantly. At least there was a time
when doing perf testing I noticed chrome's event dispatch speed regressed
quite a bit)

FWIW, this code has been extensively rewritten many times and we have not seen this particular codepath being a perf issue in real world.

I am not saying that we haven't done our share of poorly-written code when we first started exploring the problem, but the algorithm we settled on and what's in spec today is O(N). You shouldn't see any dramatic perf problems.


comment: 84
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c84
Boris Zbarsky wrote on 2014-03-28 18:57:18 +0000.

Just to note the obvious, O(N) is a necessary but not sufficient condition for non-sucky event dispatch performance. The constant matters a lot.


comment: 85
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c85
Dimitri Glazkov wrote on 2014-03-28 19:00:15 +0000.

(In reply to Boris Zbarsky from comment #84)

Just to note the obvious, O(N) is a necessary but not sufficient condition
for non-sucky event dispatch performance. The constant matters a lot.

Yup :) I similarly don't want us to speculate about performance problems without any actual data to back it up.


comment: 86
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c86
Olli Pettay wrote on 2014-03-28 19:20:15 +0000.

So, just to clarify, the complains I have are about the case when
we redistribute.

After chatting with sicking and still feel that
either we need to remove insertion points from the path
or do effectively comment 55.

In other words
Replace the "If the destination insertion points of CURRENT is not empty: .."
part with something like where you have the same list of insertion points as now, but if an insertion point foo has the same parent as what is a shadowroot's host, you put insertion point after that shadowroot in the event path.


comment: 87
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c87
Olli Pettay wrote on 2014-03-28 19:33:07 +0000.

(In reply to Olli Pettay from comment #86)

In other words
Replace the "If the destination insertion points of CURRENT is not empty: .."
part with something like where you have the same list of insertion points as
now, but if an insertion point foo has the same parent as what is a
shadowroot's host, you put insertion point after that shadowroot in the
event path.

Except that this can also lead to diamond shapes if you compare two paths.
(but otherwise this feels more logical than the current spec behavior)


comment: 88
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c88
Dimitri Glazkov wrote on 2014-03-28 19:41:52 +0000.

(In reply to Olli Pettay from comment #86)

In other words
Replace the "If the destination insertion points of CURRENT is not empty: .."
part with something like where you have the same list of insertion points as
now, but if an insertion point foo has the same parent as what is a
shadowroot's host, you put insertion point after that shadowroot in the
event path.

I thought Hayato provided a pretty good rationale in comment 67 for why this idea is not good? Did you have a chance to read that comment?


comment: 89
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c89
Olli Pettay wrote on 2014-03-28 20:06:13 +0000.

It full fills (A)
(well, if we don't want to put the shadowroot, we can just cut it from the path.)
So I don't see what the issue is.

And the path for the example would be
3,2,10,9,6,7,13,12,5,1

(assuming we don't put shadowroots there.)


comment: 90
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c90
Boris Zbarsky wrote on 2014-03-28 20:37:17 +0000.

We put together an etherpad to look at some examples, at https://etherpad.mozilla.org/RKukNtHHlO

I think my intuition, when formalized, would boil down to changing http://w3c.github.io/webcomponents/spec/shadow/#event-paths to the following:

  1. Let PATH be the empty ordered list of nodes
  2. Let CURRENT be NODE
  3. Add CURRENT to PATH
  4. Set INSERTION_POINTS to be the destination insertion points of NODE.
  5. If INSERTION_POINTS is not empty:
    1. Set INS to the last element of INSERTION_POINTS.
    2. Remove the last element from INSERTION_POINTS.
    3. Set CURRENT to INS.
    4. Add CURRENT to PATH.
  6. Repeat while CURRENT exists:
    1. If CURRENT is a shadow root:
      1. If NODE and CURRENT are in the same node tree and EVENT is one of the
        events which must be stopped:
        1. Stop this algorithm
      2. If INSERTION_POINTS is not empty:
        1. Set INS to the last element of INSERTION_POINTS.
        2. While INS is a shadow insertion point:
          1. Remove the last element from INSERTION_POINTS.
          2. Add INS to PATH.
          3. Add the older shadow root relative to the root node of INS to
            PATH.
        3. Remove the last element from INSERTION_POINTS.
        4. Add INS to PATH.
      3. Let CURRENT be the shadow host which hosts CURRENT
        1. Add CURRENT to PATH
    2. Otherwise:
      1. Let CURRENT be the parent node of CURRENT
      2. If CURRENT exists:
        1. Add CURRENT to PATH

Take the shadow insertion point bit with a grain of salt. For example, I don't understand why the spec has the "If SHADOW-ROOT is not the oldest shadow root" clause: it seems like if "destination insertion points" contains a shadow insertion point that means ipso facto that its root was not the oldest shadow root.... In any case, I modeled this above as basically the newer shadow tree being applied to the old shadow root, with distribution happening into shadow insertion points instead of normal insertion points. Hopefully that understanding of how multiple shadow trees and shadow insertion points work is correct.

Basically, the upshot is that insertion points here are kept with their parent in the dispatch path as opposed to being kept with their distributed nodes.

It's not obvious that this is any simpler spec-wise than what's in the spec right now (and in fact it looks a bit more complicated, though mostly because of the shadow handling). What do people think of the effects on the mental model for consumers of shadow DOM, though?


comment: 91
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c91
Jonas Sicking wrote on 2014-03-28 20:50:34 +0000.

I would be fine with this approach assuming that it doesn't cause any perf issues.


comment: 92
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c92
Dimitri Glazkov wrote on 2014-03-28 21:10:56 +0000.

(In reply to Boris Zbarsky from comment #90)

Basically, the upshot is that insertion points here are kept with their
parent in the dispatch path as opposed to being kept with their distributed
nodes.

I am still walking through examples, and it looks like the modification preserves the invariant I care about -- that inside of a given shadow tree, the author sees a consistent even path -- is preserved. Both spec and this proposal result in a matryoshka nesting, which is good.


comment: 93
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c93
Olli Pettay wrote on 2014-03-28 21:16:06 +0000.

(In reply to Jonas Sicking from comment #91)

I would be fine with this approach assuming that it doesn't cause any perf
issues.

It shouldn't be any slower than what is in the spec.
(removing insertion points from the path would be a bit faster).

This approach is fine to me. It has the diamond issue as I said, but
at least it would make event propagate in the final tree in somewhat expected order.


comment: 94
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c94
Dimitri Glazkov wrote on 2014-03-28 23:39:49 +0000.

(In reply to Olli Pettay from comment #82)

The setup the spec has oddly prioritizes top most shadow trees over the
nested ones.
Using https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c62 as an example.
if p1.onclick = function(e) { e.stopPropagation(); }, then nothing
in the shadow tree 2 will see the event during bubble phase.
And since shadow tree 1 is there first also during capture phase,
p1.parentNode.addEventListener("click", function(e) { e.stopPropagation() },
true); would also prevent shadow tree 2 to see the event.
Why the shadow tree which has the final insertion has lower priority than
the first shadow tree?

I tried to apply this thinking to both the spec'd and newly proposed event paths and I am stuck. Please help.

Let's take example 2 from https://etherpad.mozilla.org/RKukNtHHlO.

Suppose that I am an author of sh1 and sh2 is actually some component that I found on the internet. I have no idea how it works. The author of this component, however, calls e.stopPropagation() in ip2. Let's say I don't know this. That's what composition is about, right? :)

In spec'd event path, I see this the resulting event path as [x1, ip1]. Which sort of makes sense -- I clicked on x1, and I should at least hear something coming out of ip1, because I know that x1 is distributed there.

In new proposal, I see [x1] only. That seems bad. Suddenly, even though x1 is distributed into my ip1, some force of nature grabbed the emergency brake and my event just disappeared.

Am I crazy? At least to me, the spec'd event path actually makes sense, whereas the new proposal results in mysterious silence.


comment: 95
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c95
Jonas Sicking wrote on 2014-03-28 23:43:31 +0000.

Dimitri, isn't the same thing true in the current spec if you are the author of sh2 and sh1 is something you found on the internet?


comment: 96
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c96
Dimitri Glazkov wrote on 2014-03-28 23:44:39 +0000.

(In reply to Jonas Sicking from comment #95)

Dimitri, isn't the same thing true in the current spec if you are the author
of sh2 and sh1 is something you found on the internet?

That doesn't work that way :) I can't find something that uses me. Only the other way round.


comment: 97
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c97
Boris Zbarsky wrote on 2014-03-29 01:36:44 +0000.

I can't find something that uses me.

You can, because of capturing listeners. :(

If in example 2 a capturing listener on ip2 or sr2 calls stopPropagation, the author of sh1 will see the event hit capturing listeners on ip1 but not hit any listeners at all on x1.

In fact, even in the spec's setup calling stopPropagation in a capturing listener on ip2 will mean that sr1 gets the event in the capture phase but then ip1 and x1 never see it.

The only sane way to avoid composition issues with stopPropagation is to make stopPropagation tree-local or something... or something. Speaking of complexity.


comment: 98
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c98
Boris Zbarsky wrote on 2014-03-29 01:39:44 +0000.

And even with bubbling listeners, in the spec setup if ip2 calls stopPropagation in the bubble phase, you will see the event during the bubble phase at ip1 but not at sh2 or sr1... Basically, stopPropagation is the mind-killer. It is the little-death that brings total obliteration of composition. :(


comment: 99
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c99
Hayato Ito wrote on 2014-03-31 08:02:48 +0000.

The following has been on my radar for a long time:

  • Whether calling event.stopPropagation() should affect the event dispatching in other node trees or not.

AFAIR, I think this is the first time when this topic is being discussed in the Shadow DOM spec bugzilla.

In the current spec, calling event.stopPropagation() in a node tree affects the event dispatching in other node trees, as you notice.

In the past, I thought that we shouldn't make event.stopPropagation() affect the behavior of event dispatching in node trees other than the current node tree. I thought that an event dispatching in each node tree must be completely independent. However, no one has taken care of this topic so far, except for me.

This is the typical situation where it's difficult to satisfy both worlds - the tree of trees world and the composed tree world.

I prefer the current rule. Calling an event.stopPropagation stops an entire event dispatching, including event dispatching in other node trees. It's simple and easy to implement and might be useful for some situations.

However it's worth discussing. I think we haven't have enough opinions from web developers about this topic.


comment: 100
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c100
Olli Pettay wrote on 2014-04-11 13:46:05 +0000.

Hayato, Dimitri, I'd like to understand what are the issues in the approach
explained rather clearly in comment 90.
As far as I see it makes event path more logical, and consistent when comparing to event propagation in DOM in genenal, than the current spec
since the top most shadow dom isn't handled in a special way, and yet
it keeps event handling within all the shadow doms consistent.

event.stopPropagation() should have the same behavior it has now in non-shadow-DOM. During capture phase things closer to the root node have
priority over those closer to the target, and in case of bubble phase vice-versa.
The spec doesn't current give that behavior , but the approach from comment 90
does.


comment: 101
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c101
Hayato Ito wrote on 2014-04-11 14:26:41 +0000.

Okay. I've taken a look at the algorithm in comment #90 closely.

I think the algorithm in comment #90 doesn't work as intended because it doesn't consider the case where a distribution happens at more than one node in the event path.

In the while loop of "Repeat while CURRENT exists:", CURRENT can have non-empty destination insertion points. In that case, we should consider the destination insertion points of CURRENT again as the algorithm does it at step 4 and 5.

Therefore, INSERTION_POINTS can't be a global variable. I guess we need a stack of INSERTION_POINTS or something like.
Although I've not tried to fix the algorithm, the algorithm might become more complex than that of #comment 90 to make ti work-as-intended.


comment: 102
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c102
Boris Zbarsky wrote on 2014-04-11 15:51:18 +0000.

Good catch. You're correct that we'd need to make INSERTION_POINTS a stack of lists, pushing onto it when we hit a CURRENT with nonempty insertion points and popping off it when we remove the last item of the currently-top list.


comment: 103
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c103
Boris Zbarsky wrote on 2014-04-11 15:53:26 +0000.

Though actually, maybe that's not the right ordering. I'll need to sit down with some concrete cases to see what the right behavior here is.

I agree that it will make the algorithm more complicated. :(


comment: 104
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c104
Hayato Ito wrote on 2014-04-11 21:24:02 +0000.

(In reply to comment #103)

Though actually, maybe that's not the right ordering. I'll need to sit down
with some concrete cases to see what the right behavior here is.

I agree that it will make the algorithm more complicated. :(

Yeah, I guess it might be tough task to define the algorithm nicely so that the relative order of insertion points in the same destination insertion points gets reversed in the event path.

That requires a kind of a non-trivial technique and I'm afraid that makes the algorithm complicated one.


comment: 105
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c105
Hayato Ito wrote on 2014-04-21 09:10:24 +0000.

Let me announce that I've just added a non-normative section, 'Event Paths Example', to the spec, hoping that it would be helpful for everyone to understand the current spec and the problem space we must handle.

http://w3c.github.io/webcomponents/spec/shadow/#event-paths-example

I think it is worth while to share a non-trivial example used in the section so that we don't miss a non-trivial case further.


comment: 106
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c106
Hayato Ito wrote on 2014-05-09 08:24:58 +0000.

I've tried to examine whether an alternative idea proposed in this discussion work well for the example 1 or not. However, I am afraid that a proposal is not well described so I can't figure out how a proposal work for the example.

I appreciate if someone would help me to make it clear how an alternative algorithm work for the example.

Let me close this issue if no one could have an alternative algorithm which works well for the example.


comment: 107
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c107
Olli Pettay wrote on 2014-05-09 09:14:17 +0000.

Just a note that the general consensus during the f2f (if I managed to follow the discussion correctly remotely - I did miss some of it) seemed to be that the setup in the spec isn't what is wanted, but the alternative more
normal child-parent propagation.

I'll try to write the algorithm still during this weekend.
As far as I see, at least currently, it just needs to be recursive so that we incorporate all the shadow trees in the path.


comment: 108
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c108
Hayato Ito wrote on 2014-05-09 10:03:31 +0000.

Thank you. I appreciate that.

(In reply to Olli Pettay from comment #107)

Just a note that the general consensus during the f2f (if I managed to
follow the discussion correctly remotely - I did miss some of it) seemed to
be that the setup in the spec isn't what is wanted, but the alternative more
normal child-parent propagation.

Yep, I thought that. However once I tried to make it a concrete algorithm, I realized that there are a lot of unclear points. Therefore I need your help to understand the alternative.

Let's solve this long discussion together.


comment: 109
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c109
Hayato Ito wrote on 2014-08-25 03:28:47 +0000.

I am wondering whether we can close this bug or not so that we can focus higher priority bugs.

We can reopen this bug anytime later if we feel we need a further discussion.


comment: 110
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c110
Olli Pettay wrote on 2014-08-25 13:47:52 +0000.

We're not going to implement the event handling currently in the spec.
And the WG agreed that it is not the right solution.

There is now a WIP algorithm
https://bugzilla.mozilla.org/show_bug.cgi?id=887541#c13


comment: 111
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c111
Hayato Ito wrote on 2014-08-26 04:05:09 +0000.

Thank you for letting me know that you have WIP algorithm.

I am strongly interested in the result of the WIP algorithm if we apply that to the example tree of trees used in '5.3 Event Paths Example' 1.
I am curious what is difference between the current one and WIP's one. Then, I would like to know which is better.

If WIP algorithm is ready to be applied, please let me know that.

1 http://w3c.github.io/webcomponents/spec/shadow/#event-paths-example


comment: 112
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c112
Olli Pettay wrote on 2014-08-28 13:03:41 +0000.

The example is hard to read. Showing the final flattened tree next to it would be useful.


comment: 113
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c113
Olli Pettay wrote on 2014-08-28 13:29:36 +0000.

[D, C, I, M, L, P, R, Q, O, N, K, J, H, G, U, T, S, F, E, X, W, V, B, A]
becomes
[D, C, M, L, R, Q, O, P, N, K, J, I, H, G, U, T, S, F, E, X, W, V, B, A](still verifying. I guess I should write a test)

The main thing is that 'I' is in the more natural place in the chain.


comment: 114
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c114
Olli Pettay wrote on 2014-08-28 19:59:13 +0000.

Looks like the wip algorithm needs still small tweak to cover event propagation
N->K-J-I-H


comment: 115
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c115
Olli Pettay wrote on 2014-08-28 21:37:20 +0000.

https://bugzilla.mozilla.org/show_bug.cgi?id=1059989#c2 does some tweaking
and the result would be
D,C,M,L,R,Q,P,O,N,K,J,I,H,G,U,T,S,F,E,X,W,V,B,A


comment: 116
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c116
Hayato Ito wrote on 2014-08-29 02:49:13 +0000.

Olli, thank you for the explanation.

Now I can say I understand the intention clearly. It's great to design the concrete algorithm. I've enjoyed reading and running the WIP algorithm in my head. It seems promising.

Aa far as I understand, the result between the current one and WIP one differ only if a re-distribution happens.
If re-distribution occurs, they put non-final destination insertion points in different places.

I don't have a strong opinions about which is better because both satisfy the main goal which I explained in '5.3 Event Paths Example':

http://w3c.github.io/webcomponents/spec/shadow/#event-paths-example

That means if we focus on one node tree and forget all other node trees, the event path would be seen as if the event happened only on the node tree which we are focused on. This is an important aspect in a sense that hosting shadow trees doesn't have any effect to the event path within the node tree the shadow host participate in as long as the event is not stopped somewhere in the descendant trees.

For example, from the view of the document tree 1, the event path would be seen as [D, C, B, A]. From the view of the shadow tree 2, the event path would be seen as [I, H, G, F, E]. The similar things also apply to other node trees.

It is also worth pointing out that if we exclude all insertion points and shadow roots from an event path, the result would be equivalent to the inclusive ancestors of the node on which the event is dispatched, in the composed tree.

From the view of difficulty in implementing, I don't have any concerns because both algorithm seem simple enough. That's great.

I am not sure how many developers will notice the difference between them and how important the difference is.
I'd like to hear opinions from developers about what use cases would tell the difference between them and when the difference matters.


comment: 117
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c117
Jonas Sicking wrote on 2014-08-29 02:57:28 +0000.

Yes, my understanding is that there is only a difference when redistribution happens. And the difference is only in where insertion points are located. All non-insertion-point elements will always have the same relative order in both algorithms.


comment: 118
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c118
Olli Pettay wrote on 2014-09-19 11:17:45 +0000.

Hayato, have you had chance to look at
the proposed algorithm in https://bugzilla.mozilla.org/show_bug.cgi?id=1059989


comment: 119
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c119
Hayato Ito wrote on 2014-09-22 08:46:31 +0000.

No. It seems the algorithm has been updated after I checked last time.
Let me take a look. Thank you for letting me know that.

Hayato, have you had chance to look at
the proposed algorithm in
https://bugzilla.mozilla.org/show_bug.cgi?id=1059989


comment: 120
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c120
Hayato Ito wrote on 2014-09-30 06:23:10 +0000.

I've taken a look at the algorithm in https://bugzilla.mozilla.org/show_bug.cgi?id=1059989#c10.

It looks the algorithm became more complex than before. That made it difficult for me to audit the correctness, however, it seems it will work for the example case, 5.3 Event Paths Example, as intended at least.

One suggestion: Could you avoid to use a term of projected? The projected is not defined in the spec.


comment: 121
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c121
Olli Pettay wrote on 2014-09-30 09:32:40 +0000.

Sure. Could it be just OLDER-SHADOW-ROOT?


comment: 122
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c122
Hayato Ito wrote on 2014-10-01 06:36:50 +0000.

(In reply to Olli Pettay from comment #121)

Sure. Could it be just OLDER-SHADOW-ROOT?

I meant we might want to update the following sentence in the algorithm, as an example:

Let SHADOW-POOL-HOST be the shadow insertion point into which CURRENT shadow root is projected.

Because the spec doesn't define what 'projected' means for a shadow root, I think we cay say, instead, if we want to make it more explicit:

Let SHADOW-POOL-HOST be the shadow insertion point in the younger shadow tree relative to the shadow tree whose root is CURRENT shadow root.

We can update other sentences where projected is used, in a similar way.

BTW, I don't have much worry about optimizing (and correcting?) the proposed algorithm as long as the result will be an equivalent because now I understand the intention of the proposal and it's feasibility.

Rather, I'd like to hear early feedbacks from developers, especially polymer developers and users, to know use cases where the difference of resulting event path between the current one and the proposed one matters. I have no idea when it matters.

I appreciate any feedbacks and opinions so that we can decide.


comment: 123
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c123
Olli Pettay wrote on 2014-10-07 19:39:03 +0000.

(In reply to Hayato Ito from comment #122)

Rather, I'd like to hear early feedbacks from developers, especially polymer
developers and users, to know use cases where the difference of resulting
event path between the current one and the proposed one matters. I have no
idea when it matters.
Have you asked Polymer devs, or hopefully other devs too? (we should not focus too much on feedback
from one script library only.) Any feedback yet?

I appreciate any feedbacks and opinions so that we can decide.
(I could also remind what was discussed during the last Webapps f2f ;) )


comment: 124
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c124
Hayato Ito wrote on 2014-10-08 05:56:09 +0000.

I'm afraid that this discussion thread became too long and it would be hard for new comers to follow the entire discussion.
Let me summarize the current situation here, hoping it would make it easy for developers to compare both and give us feedbacks easily.

There are two proposals about how event path should be.
It would be a little hard for me to explain each briefly. Therefore, let me use an concrete example to explain the difference between them here.

Let's use an example of http://w3c.github.io/webcomponents/spec/shadow/#event-paths-example.
(Sorry about that this example is a bit complex, but it is necessary to know the difference)

  1. The current one:

See http://w3c.github.io/webcomponents/spec/shadow/#dfn-event-path-calculation-algorithm for details.
The result event path for the example will be (as the spec explains):
[D,C,I,M,L,P,R,Q,O,N,K,J,H,G,U,T,S,F,E,X,W,V,B,A]

  1. The new one

See https://bugzilla.mozilla.org/show_bug.cgi?id=1059989 for details.
The result event path for the example will be:
[D,C,M,L,R,Q,P,O,N,K,J,I,H,G,U,T,S,F,E,X,W,V,B,A]

Some notes:

Both satisfy the original goal which the spec explained as follows:

That means if we focus on one node tree and forget all other node trees, the event path would be seen as if the event happened only on the node tree which we are focused on. This is an important aspect in a sense that hosting shadow trees doesn't have any effect to the event path within the node tree the shadow host participate in as long as the event is not stopped somewhere in the descendant trees.
For example, from the view of the document tree 1, the event path would be seen as [D, C, B, A]. From the view of the shadow tree 2, the event path would be seen as [I, H, G, F, E]. The similar things also apply to other node trees.
It is also worth pointing out that if we exclude all insertion points and shadow roots from an event path, the result would be equivalent to the inclusive ancestors of the node on which the event is dispatched, in the composed tree.

I don't worry about the difficulty of implementation in both. I think there is no significant difference between them in a term of time complexity in a sense of big-O notation.

Please feel free to add additional information.


comment: 125
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c125
Dimitri Glazkov wrote on 2014-10-08 14:07:10 +0000.

With my developer hat only, my experience is that this mostly does not matter. This is one of those platform changes that platform developers agonize over and web developers never notice.

I think we should do make this change and move on.


comment: 126
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c126
Olli Pettay wrote on 2014-10-08 14:25:55 +0000.

(In reply to Dimitri Glazkov from comment #125)

With my developer hat only, my experience is that this mostly does not
matter.
This would be my guess too

This is one of those platform changes that platform developers
agonize over and web developers never notice.
Well, web developers do notice the inconsistencies in API behavior eventually.
Inconsistencies in APIs tend to show up later, often when it is too late
to fix them.
("load" event propagation as an example - now we need to have a special event propagation path for one specific event type. It complicates the platform and
people tend to not remember the special case.
But it was too late to fix "load" already in 2006.)


comment: 127
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c127
Steve Orvell wrote on 2014-10-08 18:35:08 +0000.

I think the new proposal is good.

All the composition use cases in this thread are satisfied. It also makes some sense that the order of the insertion points in the event path is the reverse of the destination insertion points list. Similarly, it makes sense that we get subtrees contiguously (e.g. P, O, N and I, H, G).


comment: 128
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c128
Hayato Ito wrote on 2014-10-09 01:59:02 +0000.

Thank you for the feedbacks.

Now I am feeling that there is no blocking issue to adapt the new proposal, right?
If someone has an objection or find a flaw in the new proposal, please let us know that.

There might be a hidden bug or room for optimization in the new proposal, but it doesn't matter as long as the result event path is equivalent, I think.
That might be an implementation detail and we can optimize or fix the bug later.

Let me update the spec and make sure it will work actually.


comment: 129
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c129
Hayato Ito wrote on 2014-10-16 09:32:18 +0000.

If there is any update on the algorithm described in https://bugzilla.mozilla.org/show_bug.cgi?id=1059989, please let me know that.

I'll try to update the spec based on https://bugzilla.mozilla.org/show_bug.cgi?id=1059989#c10 in a few days.


comment: 130
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c130
Hayato Ito wrote on 2014-10-31 04:23:02 +0000.

Let me try to implement the new proposal locally (only in my machine :)) in blink before speccing that.
I'd like to make sure that it really works and breaks nothing in blink. I need an experiment to have a confidence.


comment: 131
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c131
Hayato Ito wrote on 2014-11-11 08:07:36 +0000.

Status update:

No progress so far. Please let me know if this issue is blocking something. I'll raise the priority of this task.

I'll use the algorithm described in https://bugzilla.mozilla.org/show_bug.cgi?id=1059989 as a reference. If there is any update on this, please let me know that.


comment: 132
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c132
Olli Pettay wrote on 2015-01-21 11:54:17 +0000.

(In reply to Hayato Ito from comment #131)

Status update:

No progress so far. Please let me know if this issue is blocking something.
I'll raise the priority of this task.

Well, this is one of the biggest issues open in shadow DOM, IMO
(this and is-in-document case)


comment: 133
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c133
Hayato Ito wrote on 2015-01-22 01:58:19 +0000.

(In reply to Olli Pettay from comment #132)

(In reply to Hayato Ito from comment #131)

Status update:

No progress so far. Please let me know if this issue is blocking something.
I'll raise the priority of this task.

Well, this is one of the biggest issues open in shadow DOM, IMO
(this and is-in-document case)

Thanks for letting me know that. I've marked this as P1. I'll work on this soon.


comment: 134
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c134
Hayato Ito wrote on 2015-02-04 22:05:28 +0000.

Status update:

I've asked koji (kojii@chromium-(migrated-from-bugzilla-to-avoid-pinnging-users-in-github).org) to work on this.

kojii@, could you tentatively implement the new proposal in blink and see how things work well?


comment: 135
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c135
Koji Ishii wrote on 2015-02-05 14:14:01 +0000.

I'm on it.


comment: 136
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c136
Koji Ishii wrote on 2015-02-06 08:42:30 +0000.

Olli, could you clarify one point I didn't get very well in the proposed algorithm?
https://bugzilla.mozilla.org/show_bug.cgi?id=1059989#c10

5.2.3.1. Let SHADOW-POOL-HOST be the shadow insertion point into which CURRENT shadow root is projected.

I don't understand what "projected" means, I'm guessing it's equivalent to "distributed" from comment 122. But the whole 5.2 is executed only when "the destination insertion points of CURRENT" is empty by the "if" in 5.1, so the CURRENT is not supposed to be distributed.

Do I misunderstand what "projected" means, or something else?


comment: 137
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c137
Hayato Ito wrote on 2015-02-06 09:23:04 +0000.

"reprojection" is the old terminology, which the recent Shadow DOM spec hasn't used.

It should be equivalent to "re-distribution".

Olli, if you are using 'reprojection' in other meaning, please let kojii@ know that.


comment: 138
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c138
Olli Pettay wrote on 2015-02-06 11:42:35 +0000.

Yeah, it is about distribution.


comment: 139
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c139
Koji Ishii wrote on 2015-02-07 10:45:39 +0000.

Thank you Olli and Hayato.

But then the

5.2.3.1. Let SHADOW-POOL-HOST be the shadow insertion point into which CURRENT shadow root is projected.

looks like a bug to me, because this is executed only when the destination insertion points of CURRENT is empty, so the CURRENT shadow root is not supposed to be distributed and SHADOW-POOL-HOST becomes NULL.

Did I miss something?


comment: 140
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c140
Hayato Ito wrote on 2015-02-09 06:32:32 +0000.

(In reply to Koji Ishii from comment #139)

Thank you Olli and Hayato.

But then the

5.2.3.1. Let SHADOW-POOL-HOST be the shadow insertion point into which
CURRENT shadow root is projected.

You are right. This looks wrong.

I guess the what this sentence is tying to say is:

Let SHADOW-POOL_HOST be the shadow insertion point in the younger shadow root (of the CURRENT shadow root) if such the shadow insertion points exits.


comment: 141
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c141
Koji Ishii wrote on 2015-02-12 06:28:18 +0000.

With so much thanks to Olli, wchen, and Hayato, I've experimentally implemented the proposed algorithm, and now I'm seeing two different results in our tests.

The two are minor, but since they are changes in the behavior not discussed in this thread yet, any opinions/insights from anyone is also appreciated.

  1. The proposed algorithm stops event path for orphaned nodes
    When target nodes are not distributed, the event path in the current spec bubbles up to Document, but the proposed algorithm stops. Example:

A
SR
B

Note that SR does not have IP. When an event fires on B, the event path is:
Current: B, SR, A, Document, Window
Proposed: B

This also occurs when younger shadow roots do not have any shadow insertion points.

I think this is a subtle detail we can ignore, and this difference does not prevent the proposed algorithm to be accepted. If anyone think differently, appreciate comments.

  1. Events that are Always Stopped at...where?
    The current spec of "Events that are Always Stopped" says "...stopped at the root node of the node tree"
    http://w3c.github.io/webcomponents/spec/shadow/#h-events-that-are-always-stopped

Current our implementation allows older and younger shadow roots to receive the event and stops before shadow hosts. The behavior was changed by the experimental implementation, probably because the order was changed.

I can't determine if "the root node of the node tree" includes older/younger shadow roots, I'll discuss with Hayato for clarification.


comment: 142
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c142
Hayato Ito wrote on 2015-02-12 08:49:36 +0000.

We should treat this kind of unintentional change as a bug of the new proposal unless these are intentional ones.

Please don't change any behavior except for reordering insertion points in the event path because that's the only proposed change, AFAIK.

Please file a new bug if this is an intentional change.


comment: 143
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c143
Olli Pettay wrote on 2015-02-12 12:48:57 +0000.

(In reply to Koji Ishii from comment #141)

With so much thanks to Olli, wchen, and Hayato, I've experimentally
implemented the proposed algorithm, and now I'm seeing two different results
in our tests.

The two are minor, but since they are changes in the behavior not discussed
in this thread yet, any opinions/insights from anyone is also appreciated.

  1. The proposed algorithm stops event path for orphaned nodes
    When target nodes are not distributed, the event path in the current spec
    bubbles up to Document, but the proposed algorithm stops. Example:

A
SR
B

Note that SR does not have IP. When an event fires on B, the event path is:
Current: B, SR, A, Document, Window
Proposed: B

But shouldn't B's destination insertion points be empty and from B event propagate to A.
Or do I misunderstand your example?
(B is a child node of A)

This also occurs when younger shadow roots do not have any shadow insertion
points.
In which case exactly? If you dispatch event to a node in older shadow tree and younger
doesn't have insertion point, event should propagate only to the older shadow root.

  1. Events that are Always Stopped at...where?
    The current spec of "Events that are Always Stopped" says "...stopped at the
    root node of the node tree"
    http://w3c.github.io/webcomponents/spec/shadow/#h-events-that-are-always-
    stopped

Current our implementation allows older and younger shadow roots to receive
the event and stops before shadow hosts.
hosts? plural?

mousemove within older shadow dom shouldn't propagate to the younger shadow dom


comment: 144
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c144
Koji Ishii wrote on 2015-02-13 01:39:44 +0000.

Moved the second issue to bug 28008. It looks like a spec bug, and may need further discussions.

Allow me to look into the first issue again, I tried to minimize the case and it looks like I lost some required condition to reproduce, or maybe my impl problem.


comment: 145
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c145
Koji Ishii wrote on 2015-02-13 02:12:59 +0000.

The case where younger shadow roots do not have shadow insertion points:

A
SR1
B
SR2

When an event fired on B:
Current: B, SR1, A, Document, Window
Proposed: B, SR1


comment: 146
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c146
Hayato Ito wrote on 2015-02-13 03:08:49 +0000.

(In reply to Olli Pettay from comment #143)

  1. Events that are Always Stopped at...where?
    The current spec of "Events that are Always Stopped" says "...stopped at the
    root node of the node tree"
    http://w3c.github.io/webcomponents/spec/shadow/#h-events-that-are-always-
    stopped

Current our implementation allows older and younger shadow roots to receive
the event and stops before shadow hosts.
hosts? plural?

mousemove within older shadow dom shouldn't propagate to the younger
shadow dom

That's orthogonal problem, which should be handled by event-related-target algorithm and the following sentence in http://w3c.github.io/webcomponents/spec/shadow/#event-dispatch

If the relatedTarget and target are the same for a given node, its the event listeners must not be invoked. TouchEvent is not subject to this rule.

In addition to that, in this case, it's okay for the younger to see the mouse move within the older for the same reason that the shadow tree can see mouse move for distributed nodes in it's shadow host. I think the current algorithm is designed to achieve that.


comment: 147
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c147
Hayato Ito wrote on 2015-02-13 03:19:02 +0000.

(In reply to Koji Ishii from comment #145)

The case where younger shadow roots do not have shadow insertion points:

A
SR1
B
SR2

When an event fired on B:
Current: B, SR1, A, Document, Window
Proposed: B, SR1

I can't agree this proposal because this violates the design principle of Shadow DOM event dispatching of the following:

"Attaching a Shadow Root to an element shouldn't have any effect for an event dispatching in the node tree which the shadow host participates in, basically"

In the proposal, attaching the younger shadow root would affect the event dispatching in the document tree. That would violated the principle.


comment: 148
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c148
Koji Ishii wrote on 2015-02-13 04:45:29 +0000.

(In reply to Olli Pettay from comment #143)

(In reply to Koji Ishii from comment #141)

  1. The proposed algorithm stops event path for orphaned nodes
    When target nodes are not distributed, the event path in the current spec
    bubbles up to Document, but the proposed algorithm stops. Example:

A
SR
B

Note that SR does not have IP. When an event fires on B, the event path is:
Current: B, SR, A, Document, Window
Proposed: B

But shouldn't B's destination insertion points be empty and from B event
propagate to A.
Or do I misunderstand your example?
(B is a child node of A)

Sorry, I simplified the test case too much. The reproducible case is:

A
SR
SIP
B

In this tree, B's destination insertion point is not empty, but B is not distributed. When an event fired on B:
Current: B, SIP, SR, A, Document, Window
Proposed: B

So the two cases are similar but hit different causes:
1.1. When the shadow tree contains but no
1.2. When the younger shadow tree does not contain

When the shadow tree does not contain either nor , you're right that both algorithms produce the same results.


comment: 149
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c149
Olli Pettay wrote on 2015-02-13 22:34:21 +0000.

(In reply to Hayato Ito from comment #147)

(In reply to Koji Ishii from comment #145)

The case where younger shadow roots do not have shadow insertion points:

A
SR1
B
SR2

When an event fired on B:
Current: B, SR1, A, Document, Window
Proposed: B, SR1

I can't agree this proposal because this violates the design principle of
Shadow DOM event dispatching of the following:
No it doesn't

"Attaching a Shadow Root to an element shouldn't have any effect for an
event dispatching in the node tree which the shadow host participates in,
basically"
B is a child of SR1 in this case, not part of the node tree of A.

In the proposal, attaching the younger shadow root would affect the event
dispatching in the document tree. That would violated the principle.

No, B is a child of SR1.
(or I misunderstand where B is.)


comment: 150
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c150
Olli Pettay wrote on 2015-02-13 22:42:03 +0000.

(In reply to Koji Ishii from comment #148)

Sorry, I simplified the test case too much. The reproducible case is:

A
SR
SIP
B

In this tree, B's destination insertion point is not empty, but B is not
distributed. When an event fired on B:
Current: B, SIP, SR, A, Document, Window
Proposed: B

Wait, what is the destination insertion point for B in this case? And why?

The spec says
"Each node that is not an insertion point has an ordered list, called destination insertion points, which consists of insertion points to where the node is distributed"
So how can B's destination insertion point list be non-empty but B is not distributed.
That seems to contradict with the definition of 'destination insertion points'.

Or do I misunderstand something here?


comment: 151
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c151
Hayato Ito wrote on 2015-02-16 01:50:49 +0000.

(In reply to Olli Pettay from comment #149)

(In reply to Hayato Ito from comment #147)

(In reply to Koji Ishii from comment #145)

The case where younger shadow roots do not have shadow insertion points:

A
SR1
B
SR2

When an event fired on B:
Current: B, SR1, A, Document, Window
Proposed: B, SR1

I can't agree this proposal because this violates the design principle of
Shadow DOM event dispatching of the following:
No it doesn't

"Attaching a Shadow Root to an element shouldn't have any effect for an
event dispatching in the node tree which the shadow host participates in,
basically"
B is a child of SR1 in this case, not part of the node tree of A.

In the proposal, attaching the younger shadow root would affect the event
dispatching in the document tree. That would violated the principle.

No, B is a child of SR1.
(or I misunderstand where B is.)

Let me make it clear what I said as follows:

  • Attaching a shadow root to any node in any node tree doesn't affect an event dispatching which will happen on any node, in the every node trees, except for the newly attached shadow tree, basically.

In the example case, we can interpret this as follows:

  • Attaching a shadow root (SR1) to any node (A) in any node tree (document tree) doesn't affect an event dispatching which will happen on any node (B), in the every node trees (both document tree and SR1 tree), except for the newly attached shadow tree (SR2 tree), basically.

"Basically" here means "as long as we don't call event.stopPropagation() in the newly attached shadow tree".


comment: 152
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c152
Koji Ishii wrote on 2015-02-16 01:56:24 +0000.

(In reply to Olli Pettay from comment #150)

(In reply to Koji Ishii from comment #148)

Sorry, I simplified the test case too much. The reproducible case is:

A
SR
SIP
B

In this tree, B's destination insertion point is not empty, but B is not
distributed. When an event fired on B:
Current: B, SIP, SR, A, Document, Window
Proposed: B

Wait, what is the destination insertion point for B in this case? And why?

The spec says
"Each node that is not an insertion point has an ordered list, called
destination insertion points, which consists of insertion points to where
the node is distributed"
So how can B's destination insertion point list be non-empty but B is not
distributed.
That seems to contradict with the definition of 'destination insertion
points'.

Or do I misunderstand something here?

I agree it's weird. I had to re-read the spec when investigating this issue, but the SIP above meets the criteria defined in "3.3 Shadow Insertion Points"
http://w3c.github.io/webcomponents/spec/shadow/#h-shadow-insertion-points

I opened bug 28031 for this. I'm ok either way, just want it to be interoperable.


comment: 153
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c153
Hayato Ito wrote on 2015-02-16 02:12:05 +0000.

(In reply to Koji Ishii from comment #152)

(In reply to Olli Pettay from comment #150)

(In reply to Koji Ishii from comment #148)

Sorry, I simplified the test case too much. The reproducible case is:

A
SR
SIP
B

In this tree, B's destination insertion point is not empty, but B is not
distributed. When an event fired on B:
Current: B, SIP, SR, A, Document, Window
Proposed: B

Wait, what is the destination insertion point for B in this case? And why?

The spec says
"Each node that is not an insertion point has an ordered list, called
destination insertion points, which consists of insertion points to where
the node is distributed"
So how can B's destination insertion point list be non-empty but B is not
distributed.
That seems to contradict with the definition of 'destination insertion
points'.

Or do I misunderstand something here?

I agree it's weird. I had to re-read the spec when investigating this issue,
but the SIP above meets the criteria defined in "3.3 Shadow Insertion Points"
http://w3c.github.io/webcomponents/spec/shadow/#h-shadow-insertion-points

I opened bug 28031 for this. I'm ok either way, just want it to be
interoperable.

I'm afraid that you didn't understand what Olli pointed out.

In this tree, B's destination insertion point is not empty, but B is not
distributed. When an event fired on B:

I don't understand what this sentence mean...
"node is not distributed" should mean "node's destination insertion is empty". That's the spec's intention.


comment: 154
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c154
Koji Ishii wrote on 2015-02-16 05:30:51 +0000.

Understood what I misunderstood, so the SIP in the oldest shadow root acts as a content insertion point. Apologies for the confusion.

While my interpretation was incorrect, the result still matches.

Now run the algorithm against:

A
SR
SIP
B

There's a bit ambiguous definition in the proposed algorithm:

5.4.1. Let PROJECTED-SHADOW be the shadow root projected into CURRENT.

What is the PROJECTED-SHADOW when CURRENT is SIP?

My code gets nullptr, because no shadow roots are distributed to the SIP, and terminates the loop. Does Gecko implement this differently?


comment: 155
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c155
Koji Ishii wrote on 2015-02-16 06:32:50 +0000.

I put test cases on jsbin: http://jsbin.com/casoyi

Chrome Canary:

  1. B1,SIP,SR1,H1,BODY,HTML,[object HTMLDocument],[object Window]
  2. B2,SR2,H2,BODY,HTML,[object HTMLDocument],[object Window]
  3. C3,SR4

Chrome with experimental impl:

  1. B1
  2. B2,SR2
  3. C3,SR4

Could you tell me what the current Gecko gives? That'd help us to figure out if the bug is in algorithm, or in my impl.

The third case was added because I added an assertion to ensure the INSERTION-POINTS stack is empty at the end of the algorithm, and it fails on one of our tests for editing. The produced event paths are the same. Not sure if this is an non-issue, or issues in both algorithm. Hayato, do you have insights?


comment: 156
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c156
Koji Ishii wrote on 2015-02-16 06:41:38 +0000.

Correction: on test case 3, events should fire on B3. Updated the jsbin: http://jsbin.com/casoyi

Chrome Canary:

  1. B1,SIP,SR1,H1,BODY,HTML,[object HTMLDocument],[object Window]
  2. B2,SR2,H2,BODY,HTML,[object HTMLDocument],[object Window]
  3. B3,SHADOW,SHADOW,SR5,C3,SR4,H3,BODY,HTML,[object HTMLDocument],[object Window]
  4. C3,SR4

Chrome with experimental impl:

  1. B1
  2. B2,SR2
  3. B3
  4. C3,SR4

comment: 157
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c157
Olli Pettay wrote on 2015-02-16 11:37:39 +0000.

(In reply to Hayato Ito from comment #151)

Let me make it clear what I said as follows:

  • Attaching a shadow root to any node in any node tree doesn't affect an
    event dispatching which will happen on any node, in the every node trees,
    except for the newly attached shadow tree, basically.

In the example case, we can interpret this as follows:

  • Attaching a shadow root (SR1) to any node (A) in any node tree (document
    tree) doesn't affect an event dispatching which will happen on any node (B),
    in the every node trees (both document tree and SR1 tree), except for the
    newly attached shadow tree (SR2 tree), basically.

Ah, you mean that. It is indeed then possible that the algorithm needs some tweaking, since it was written
during the time when older shadow trees not distributed to any shadow insertion point were thought to be not-in-document.


comment: 158
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c158
Olli Pettay wrote on 2015-02-16 11:50:26 +0000.

(In reply to Olli Pettay from comment #157)

Ah, you mean that. It is indeed then possible that the algorithm needs some
tweaking, since it was written
during the time when older shadow trees not distributed to any shadow
insertion point were thought to be not-in-document.
(and that is in fact still the behavior in Gecko, since it kind of makes sense that one can sort of replace the older shadow tree. Going through bug 26365 to see why the spec has different definition atm.)


comment: 159
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c159
Koji Ishii wrote on 2015-02-16 15:45:45 +0000.

Olli, can you also check case 1 and 3 of the http://jsbin.com/casoyi ?

Case 2 is about nodes not distributed to any shadow insertion point, but case 1 and 3 are different.

If you could come up with a tweaked algorithm that fixes all these issues, that'd be greatly appreciated.


comment: 160
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c160
Koji Ishii wrote on 2015-02-17 01:46:43 +0000.

Incorporated case 2 of comment 141 into http://jsbin.com/casoyi

Chrome Canary:

  1. click on B1: B1, SIP1, SR1, H1, BODY, HTML, [object HTMLDocument], [object Window]
  2. click on B2: B2, SR2, H2, BODY, HTML, [object HTMLDocument], [object Window]
  3. selectstart on B3: B3, SR4, SIP2, SR5
  4. selectstart on B4: B4, SIP2, SIP3, SR7, C3, SR6, H4, BODY, HTML, [object HTMLDocument], [object Window]

Experimental impl on Chrome:

  1. click on B1: B1
  2. click on B2: B2, SR2
  3. selectstart on B3: B3, SR4
  4. selectstart on B4: B4

Notes:

  • Issue 2 is about the orphaned nodes.
  • Issue 4 exits the algorithm with non-empty stack.

If you see differences in Gecko, it's possible that my interpretation of https://bugzilla.mozilla.org/show_bug.cgi?id=1059989#c10 is wrong.


comment: 161
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c161
Hayato Ito wrote on 2015-02-17 07:56:06 +0000.

(In reply to Olli Pettay from comment #158)

(In reply to Olli Pettay from comment #157)

Ah, you mean that. It is indeed then possible that the algorithm needs some
tweaking, since it was written
during the time when older shadow trees not distributed to any shadow
insertion point were thought to be not-in-document.
(and that is in fact still the behavior in Gecko, since it kind of makes
sense that one can sort of replace the older shadow tree. Going through bug
26365 to see why the spec has different definition atm.)

Yeah, that's a important (and confusing) point.

Recently, to makes things simple, I've tried to think as follows:

  • Insertion points don't have any effect on DOM connectivity.
  • Insertion points have an effect on how style inheritance is calculated. As a result, some nodes would became 'display: none', however, they are still considered as connected.
  • From this point of view, we shouldn't call the older shadow tree orphaned even when the younger shadow tree doesn't have a shadow insertion point.
    It's something like: 'display: none' is set to the pseudo parent element of (child nodes of the older shadow root).

I've tried to make the current spec consistent with this concept, recently. However, I agree we should say it more explicitly (and in a friendly way), maybe in a non-normative section.


comment: 162
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c162
Olli Pettay wrote on 2015-02-17 11:28:33 +0000.

(In reply to Hayato Ito from comment #161)

  • Insertion points don't have any effect on DOM connectivity.
    But they very much have DOM "connectivity", since they do need to affect to
    the DOM event dispatch.

But as I said in bug 26365, I can probably live with the approach where
non-distributed older shadow doms are still in the document if the host is.
(That approach may makes certain things easier in implementations, but behavior and functionality a bit weirder.)


comment: 163
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c163
Olli Pettay wrote on 2015-02-23 19:03:29 +0000.

So we want to change
3. If CURRENT is not the youngest shadow root hosted by SHADOW-POOL-HOST:
to something like

  1. If CURRENT is not the youngest shadow root hosted by SHADOW-POOL-HOST and CURRENT is distributed to a shadow insertion point:

comment: 164
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c164
Koji Ishii wrote on 2015-02-25 19:07:04 +0000.

Hayato and I discussed today and came up with a new proposal, in the hope of achieving both-win.

The proposal is to add an exception to the spec:

CURRENT:
The event path calculation algorithm must be used to determine event path and must be equivalent to processing the following steps

PROPOSED:
The event path must be equivalent to processing the event path calculation algorithm described below, except that insertion points may appear in different order, as long as they’re after the content distributed to them (or fallback content in the case of fallback) and before their parents

In case you’re uncertain whether this is a good idea, please allow me to give some background of this proposal.

What made the most sense to us was Dimitri’s comment 125 saying web developers would never notice this difference.

Still we needed to try hard to come up with a better algorithm, one because mental models vary by people, and the other because all of us want this algorithm simple and fast, while the “simple and fast” was different by the underlying architecture.

The algorithm in the current spec works good for Blink architecture, while, as far as I understand from the discussion in Bugzilla, it adds insanely complex burden to Gecko.

On the other hand, we implemented the proposed new algorithm, but we figured out that it makes our code more complex, and we are still unable to fix 3 regressions.

This indicates that, in this case, we can’t make all implementations -- including ones in future -- happy with single algorithm.

We considered another option discussed earlier, which is not to include any insertion points in the event path. But Steve, as one of the representatives of web developers, said in comment 16 that he prefers “all insertion points in event path” than “no insertion points”. This option may still work, but it looks like a both-lose option.

Our conclusion is to allow implementation dependency in the manner of not to trouble web developers is the only way to make all of us happy.

We’re hoping that this option provides good enough interoperability for web developers, while allowing simple and fast implementations on any underlying architecture to implementers, and thus also provides faster event dispatch to web developers.

Does this look like a workable solution? Comments appreciated.


comment: 165
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c165
Olli Pettay wrote on 2015-02-26 15:14:31 +0000.

(In reply to Koji Ishii from comment #164)

Hayato and I discussed today and came up with a new proposal, in the hope of
achieving both-win.
Don't understand what "both-win" refers to.

The proposal is to add an exception to the spec:

CURRENT:
The event path calculation algorithm must be used to determine event path
and must be equivalent to processing the following steps

PROPOSED:
The event path must be equivalent to processing the event path calculation
algorithm described below, except that insertion points may appear in
different order, as long as they’re after the content distributed to them
(or fallback content in the case of fallback) and before their parents
I don't understand what this all means.

Still we needed to try hard to come up with a better algorithm, one because
mental models vary by people, and the other because all of us want this
algorithm simple and fast, while the “simple and fast” was different by the
underlying architecture.

The algorithm in the current spec works good for Blink architecture, while,
as far as I understand from the discussion in Bugzilla, it adds insanely
complex burden to Gecko.
The main issue with the current algorithm in the spec is its inconsistency and mentally really
hard to get right.
What is wrong with the proposed change + the fix similar to comment 163?

I very much thought we had agreement here and just had to tweak the proposed algorithm a bit.

On the other hand, we implemented the proposed new algorithm, but we figured
out that it makes our code more complex, and we are still unable to fix 3
regressions.

What regressions?

Our conclusion is to allow implementation dependency in the manner of not to
trouble web developers is the only way to make all of us happy.
I hope you don't mean we would have implementation specific event dispatch? That is something Gecko will not do.
Shadow DOM will not be enabled by default before we have a good enough spec for it and the implementation follows it.


comment: 166
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c166
Dimitri Glazkov wrote on 2015-02-26 15:42:34 +0000.

(In reply to Olli Pettay from comment #165)

I hope you don't mean we would have implementation specific event dispatch?
That is something Gecko will not do.
Shadow DOM will not be enabled by default before we have a good enough spec
for it and the implementation follows it.

Agreed. Leaving event dispatch open to implementer interpretation sounds like a lose-lose, not a win-win.


comment: 167
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c167
Koji Ishii wrote on 2015-02-27 03:08:11 +0000.

(In reply to Olli Pettay from comment #165)

(In reply to Koji Ishii from comment #164)

Hayato and I discussed today and came up with a new proposal, in the hope of
achieving both-win.
Don't understand what "both-win" refers to.

I meant to make all impls simple and fast regardless of underlying architecture, and make all insertion points appear in the event path.

What is wrong with the proposed change + the fix similar to comment 163?

I very much thought we had agreement here and just had to tweak the proposed
algorithm a bit.

On the other hand, we implemented the proposed new algorithm, but we figured
out that it makes our code more complex, and we are still unable to fix 3
regressions.

What regressions?

The Comment 160 reported failures of 4 test case at http://jsbin.com/casoyi. I saw your comment to work on not-distributed case, and I suppose comment 163 is the one, but I don't think it fixes other cases.

I can implement it to re-test if you believe it fixes all 4 issues, but can't figure out what the proposal in comment 163 is. Could you clarify:

...and CURRENT is distributed to a shadow insertion point:

Did you mean "...and at least one shadow insertion point is the destination insertion points" or "...and the final destination point is a shadow insertion point"?

Our conclusion is to allow implementation dependency in the manner of not to
trouble web developers is the only way to make all of us happy.

I hope you don't mean we would have implementation specific event dispatch?
That is something Gecko will not do.
Shadow DOM will not be enabled by default before we have a good enough spec
for it and the implementation follows it.

Hm, looks like we have some misunderstanding. Can you clarify what I miss?

  1. You'd like to change the algorithm in the current spec.
  2. The proposed algorithm showed 4 regressions.
  3. You kindly tweaked the proposed algorithm for one of them (not really sure "one" until I understand comment 163 and re-test), but nobody has raised hands to solve other issues.

From these understandings, options I can see are:
A. Someone fixes all other issues in the proposed algorithm
B. No insertion points
C. Go with the current spec
D. Stuck

If A is not happening, the new proposal looks still better than B-D, no?


comment: 168
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c168
Hayato Ito wrote on 2015-02-27 04:38:51 +0000.

I think the point is we still don't have a new concrete algorithm which achieve the new proposal.

If Koji's idea is not acceptable, someone must try to fix the current proposed algorithm so that it doesn't have any changes which we haven't agreed.

As I said in this thread, I don't have a strong opinion about the location of insertion points in the event path.
I can live with the world where the location of insertion points are changed. However, if a new algorithm becomes too complex than the current one, I'm afraid that I have to raise the concern because it might be a bad signal, which we can discuss later once we can get a working algorithm.

Olli, I appreciate if you could help Koji to fix the proposed algorithm.


comment: 169
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c169
Olli Pettay wrote on 2015-03-01 17:01:23 +0000.

(In reply to Koji Ishii from comment #167)

Hm, looks like we have some misunderstanding. Can you clarify what I miss?

  1. You'd like to change the algorithm in the current spec.
    yes

(http://jsbin.com/casoyi/edit?html,js,output
Note, that uses the old syntax for . It was agreed long ago would need to have as a child.
But I can't now recall where that change was agreed. But that isn't really about this bug.)

Chrome Canary:

  1. click on B1: B1, SIP1, SR1, H1, BODY, HTML, [object HTMLDocument], [object Window]
  2. click on B2: B2, SR2, H2, BODY, HTML, [object HTMLDocument], [object Window]
  3. selectstart on B3: B3, SR4, SIP2, SR5
  4. selectstart on B4: B4, SIP2, SIP3, SR7, C3, SR6, H4, BODY, HTML, [object HTMLDocument], [object Window]

Experimental impl on Chrome:

  1. click on B1: B1
    Ok, so this case would need another tweak
    "Repeat while CURRENT is a shadow insertion point."
    ->
    "Repeat while CURRENT is a shadow insertion point and there is a shadow root distributed to it".
  1. click on B2: B2, SR2
    This is fixed by comment 163.
  2. selectstart on B3: B3, SR4
    This is the expected behavior. selectstart shouldn't be exposed outside its initial shadow DOM.
    The spec says "The following events must always be stopped at the root node of the node tree" and SR4 is a root.
  3. selectstart on B4: B4
    and this is similar to (1)

comment: 170
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c170
Koji Ishii wrote on 2015-03-04 00:08:16 +0000.

(In reply to Olli Pettay from comment #169)

(In reply to Koji Ishii from comment #167)

Hm, looks like we have some misunderstanding. Can you clarify what I miss?

  1. You'd like to change the algorithm in the current spec.
    yes

Great, thank you for your support.

(http://jsbin.com/casoyi/edit?html,js,output
Note, that uses the old syntax for . It was agreed long ago
would need to have as a child.
But I can't now recall where that change was agreed. But that isn't really
about this bug.)

I wasn't aware of that, will check.

Chrome Canary:

  1. click on B1: B1, SIP1, SR1, H1, BODY, HTML, [object HTMLDocument], [object Window]
  2. click on B2: B2, SR2, H2, BODY, HTML, [object HTMLDocument], [object Window]
  3. selectstart on B3: B3, SR4, SIP2, SR5
  4. selectstart on B4: B4, SIP2, SIP3, SR7, C3, SR6, H4, BODY, HTML, [object HTMLDocument], [object Window]

Experimental impl on Chrome:

  1. click on B1: B1
    Ok, so this case would need another tweak
    "Repeat while CURRENT is a shadow insertion point."
    ->
    "Repeat while CURRENT is a shadow insertion point and there is a shadow root
    distributed to it".
  1. click on B2: B2, SR2
    This is fixed by comment 163.

Ok, I'll try.

  1. selectstart on B3: B3, SR4
    This is the expected behavior. selectstart shouldn't be exposed outside its
    initial shadow DOM.
    The spec says "The following events must always be stopped at the root node
    of the node tree" and SR4 is a root.
  2. selectstart on B4: B4
    and this is similar to (1)

True that text and algorithm contradict to each other here. Hayato confirmed that the algorithm is correct. Please refer to bug 28008. IIUC, otherwise it will contradict with the policy of creating younger shadow roots should not change behavior of older shadow roots.


comment: 171
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c171
Koji Ishii wrote on 2015-03-04 06:11:06 +0000.

(In reply to Koji Ishii from comment #170)

(In reply to Olli Pettay from comment #169)

  1. click on B1: B1
    Ok, so this case would need another tweak
    "Repeat while CURRENT is a shadow insertion point."
    ->
    "Repeat while CURRENT is a shadow insertion point and there is a shadow root
    distributed to it".
  1. click on B2: B2, SR2
    This is fixed by comment 163.

Ok, I'll try.

Confirmed that these two changes fixed the 2 issues, but new 7 tests start failing. Here's the Blink test results:
https://storage.googleapis.com/chromium-layout-test-archives/linux_blink_rel/50623/layout-test-results/results.html

Olli, do you want to keep fixing the proposed algorithm? If so, does the above page provide good enough information for you to work?


comment: 172
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c172
Olli Pettay wrote on 2015-03-04 13:34:39 +0000.

That link gives 10 different pages, so I don't know which 7 failures

I'd be happy to fix the algorithm, if there is something to fix still, but,
fixing does mean changes to the expected results. The event path won't be the same, and doesn't make sense for me to fix blink's tests.

But could you perhaps email me links to the failing tests and
and tell me how the tests are failing and we can go through the
tests that way, and no need to spam this bug about blink test failures.
And if we found that there are still issues in the algorithm, then
propose changes here.


comment: 173
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c173
Koji Ishii wrote on 2015-04-09 06:25:15 +0000.

Status updates:

  1. Olli and I are working on fixing the algorithm. I forgot to update this bug for a while, sorry about that. I will try to keep the status updated here.
  2. The new algorithm proposed here:
    https://bugzilla.mozilla.org/show_bug.cgi?id=1059989#c10
    was tweaked by comments in this bug and as Olli and I discuss. I'm keeping the updated algorithm in a branch of the spec here:
    https://github.com/kojiishi/webcomponents/blob/event-path-23887/spec/shadow/index.html
  3. A WIP patch implementing the algorithm to Blink is here:
    https://codereview.chromium.org/906123002/
    Olli and I are using Blink tests to find/fix issues in the algorithm. We've narrowed down to 4 more test failures to attack.

Personally, I still can't be very clear that this additional complexity in the spec and in the implementation is worth the perceived benefits. But I think that comparison should be done once the algorithm is done without known flaws, and the final call would be up to the WG, so I'm putting that aside for now.


comment: 174
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c174
Koji Ishii wrote on 2015-04-15 01:53:38 +0000.

While I'm still unable to fix the 4 test failures in the proposed algorithm, I took another approach to re-start from the current algorithm and came up with "candidate 2" algorithm. This algorithm:

  • Produces the same result as specified in comment 115
  • Passes all tests in Blink
  • Produces the same results as the currently proposed algorithm for all tests in Blink, except the 4 failing tests

Olli told me that he can review this tomorrow or so, and we can update you all here after Olli and I discuss, but comments are appreciated if any.

"Candidate 2" algorithm:
https://cdn.rawgit.com/kojiishi/webcomponents/125051d4ea5973b459fc291636ccef8d0508501f/spec/shadow/index.html#bug23887-koji
(If re-spec prevents your browser to jump to the point, please find "candidate 2")

Blink WIP patch:
https://codereview.chromium.org/906123002/


comment: 175
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c175
Hayato Ito wrote on 2015-04-15 03:07:17 +0000.

Thank you for updating the subject, however,

[Shadow] Update event retargeting algorithm to never violate the rule of parentNode always preceeding the node in event path

the new subject is not correct because the current algorithm doesn't violate the rule.

I think comment #124 is still a good summary of the new proposal.
https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c124

Let me update the subject so that it reflects the proposal correctly.


comment: 176
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c176
Olli Pettay wrote on 2015-04-15 20:43:52 +0000.

(In reply to Koji Ishii from comment #174)

"Candidate 2" algorithm:
https://cdn.rawgit.com/kojiishi/webcomponents/
125051d/spec/shadow/index.html#bug23887-koji
(If re-spec prevents your browser to jump to the point, please find
"candidate 2")
That is very similar to the older proposed algorithm, but seems to then
fix some of its issues. I didn't look at how it ended up fixing those, but
c2 looks indeed rather good to me, and gives the expected results at least in
the cases I evaluated on paper.


comment: 177
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c177
Koji Ishii wrote on 2015-04-17 06:02:40 +0000.

Thank you Olli for your review and confirmation. I don't understand how it ended up fixing the issues either ;) but the example tree in the spec and its expected result mentioned in comment #115 are in Blink tests and the WIP patch passes it.

I submitted the spec change PR at:
#42


comment: 178
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c178
Hayato Ito wrote on 2015-04-17 06:47:40 +0000.

Thank you. Now we have a finally working proposal, right? :)

Let me have a look carefully.


comment: 179
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c179
Koji Ishii wrote on 2015-04-17 07:06:07 +0000.

(In reply to Hayato Ito from comment #178)

Thank you. Now we have a finally working proposal, right? :)

Yes, finally ;)

Let me have a look carefully.

Thank you, look forward to hearing from you.

Blink patch is also updated in case it helps:
https://codereview.chromium.org/906123002/


comment: 180
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c180
Hayato Ito wrote on 2015-04-17 07:57:19 +0000.

Bad news for you :(

Exclude shadow insertion points whose containing shadow root has older shadow roots from INSERTION-POINTS

I'm afraid this this would take us to the lose situation.

For example:

(Let me allow to use the pseudo notation to describe a tree of trees)

Note that #a's destination insertion points is [#shadow, #content].

If an event happens on #a, the event path should be (in terms of the new proposal):

[#a => #oldest-shadow-root-of-shadow-host => #content => #shadow-root-of-shadow-host-b => #shadow => #shadow-host-b => #youngest-shadow-root-of-shadow-host => #shadow-host]

But according to the algorithm of candidate 2, the event path would be:

[#a => #content => #shadow-root-of-shadow-host-b => #shadow-host-b => #youngest-shadow-root-of-shadow-host => #shadow-host]

The point is the proposed algorithm can't handle the case where re-distribution happens through shadow insertion points and content insertion points.

I'll take another look later.


comment: 181
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c181
Hayato Ito wrote on 2015-04-17 08:05:03 +0000.

If my evaluation on the paper is correct, that means Blink doesn't have such a Layout test. My bad. We should have a Layout test for that.


comment: 182
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c182
Koji Ishii wrote on 2015-04-17 08:09:01 +0000.

(In reply to Hayato Ito from comment #180)

Bad news for you :(

Thank you for having a look, actually, it's a great news to find issues earlier. I'll add a test for this case and look into further.


comment: 183
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c183
Hayato Ito wrote on 2015-04-17 08:16:17 +0000.

(In reply to Koji Ishii from comment #182)

(In reply to Hayato Ito from comment #180)

Bad news for you :(

Thank you for having a look, actually, it's a great news to find issues
earlier. I'll add a test for this case and look into further.

Thanks! I appreciate that.


comment: 184
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c184
Koji Ishii wrote on 2015-04-17 09:52:23 +0000.

Confirmed the example in comment #180 produces:
Current: #A, #SR1, #SIP, #CIP, #SR3, #SH2, #SR2, #SH1
Candidate 1: #A, #CIP, #SR3, #SR1, #SIP, #SH2, #SR2, #SH1
Candidate 2: #A, #CIP, #SR3, #SR1, #SIP, #SH2, #SR2, #SH1

I'll work on fix.


comment: 185
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c185
Hayato Ito wrote on 2015-04-17 11:21:30 +0000.

I have an idea to resolve this. Let me tackle this issue later.
I'd like to have a simple clean algorithm.


comment: 186
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c186
Koji Ishii wrote on 2015-04-18 04:40:29 +0000.

To share what Hayato and I discussed with others (before comment #185):

  • The c1/c2 results do NOT violate principals and thus acceptable
  • It's probably better for SR1 after SR2, right before SH1.
  • Hayato would try if fixing that could simplify the algorithm further, from the other principle that the simpler is the better.

comment: 187
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c187
Hayato Ito wrote on 2015-04-20 03:21:26 +0000.

Okay. Let me propose the new algorithm. Let's call this "hayato-2015-04" algorithm.

  1. Let PATH be the empty ordered list of nodes
  2. Let INSERTION-POINT-STACK be an empty stack of nodes
  3. Let CURRENT be NODE
  4. Repeat while CURRENT exists:
    1. Add CURRENT to PATH
    2. Let INSERTION-POINTS be the destination insertion points of CURRENT
    3. If INSERTION-POINTS is not empty:
      1. Push INSERTION-POINTS into INSERTION-POINT-STACK in order of first destination to final destination
      2. Pop INSERTION-POINT-STACK and set CURRENT to be the popped node.
    4. Otherwise if CURRENT is a shadow root:
      1. If CURRENT is the oldest shadow root:
        1. Let HOST be the shadow host which hosts CURRENT
      2. Otherwise:
        1. Let HOST be the older shadow root relative to CURRENT
      3. If INSERTION-POINT-STACK is not empty and the most recent node in the INSERTION-POINT-STACK is in the same node tree as HOST
        1. Pop INSERTION-POINT-STACK and set CURRENT to be the popped node.
      4. Otherwise if CURRENT and NODE participates in the same node tree and EVENT is one of the events which must be stopped:
        1. Stop this algorithm
      5. Otherwise:
        1. Let CURRENT be HOST
    5. Otherwise:
      1. Let CURRENT be the parent node of CURRENT

"hayato-2015-04" is based on my mental model - A concept of "Multiple shadow roots" are just a syntax sugar for "the older shadow root hosts the younger shadow root".
According to this concept, we can merge (4.4.1) and (4.4.2) further by the following one sentence:

"Let HOST be the shadow host (or the shadow root) which hosts CURRENT".

Note that this is the moment where we move from the child tree to the parent tree in a tree of trees. The new algorithm matches a concept of a tree of trees nicely.

As a result, "hayato-2015-04" doesn't have to use a term of {older shadow root, younger shadow root, oldest shadow root, youngest shadow root} nor {content insertion point, shadow insertion point} at all. The algorithm doesn't need to distinguish them. I'm feeling this is a good signal.

One side effect:

  • Now the older shadow root receives an event after the younger shadow root. However, this behavior matches "A shadow host receives an event after the oldest shadow root".

I can say, in a uniform way, "The root node of the parent tree receives an event after the root node of the child tree" in a tree of trees.

Caution: The new algorithm is only evaluated in my head in a short time. I'll have another look later, however, I appreciate if you could give me early feedback since I'm flying to Mountain View / San Francisco soon.


comment: 188
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c188
Koji Ishii wrote on 2015-04-20 03:52:11 +0000.

Thank you Hayato, I'll implement and run the tests.


comment: 189
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c189
Koji Ishii wrote on 2015-04-20 08:51:50 +0000.

Hayato's algorithm and its test results are here:
https://codereview.chromium.org/906123002/

  • It changes the result for the spec example to:
    #D, #C, #M, #L, #R, #Q, #P, #O, #N, #K, #J, #I, #H, #G, #U, #T, #S, #F, #X, #W, #V, #E, #B, #A
  • There's one case where the length of the path is longer by one additional node.

I'll examine these changes, but Hayato, if you could look at them from the view point that they match to what you're trying to accomplish, that'd be helpful too.

I'll post my analysis later on.


comment: 190
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c190
Olli Pettay wrote on 2015-04-20 17:58:14 +0000.

E ends up being in a really odd place. Somehow one of the shadow trees is being split and the younger tree is in the path before the that shadow tree's root.

I don't really see any reason for that.


comment: 191
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c191
Hayato Ito wrote on 2015-04-20 21:48:56 +0000.

(In reply to Koji Ishii from comment #189)

Hayato's algorithm and its test results are here:
https://codereview.chromium.org/906123002/

  • It changes the result for the spec example to:
    #D, #C, #M, #L, #R, #Q, #P, #O, #N, #K, #J, #I, #H, #G, #U, #T, #S, #F, #X,
    #W, #V, #E, #B, #A

This result is expected one for me. I'm glad to see this result.

As for the position of #E, the short answer is:

If we remove an arrow from B (the shadow host) to V (the youngest shadow root), then add a new arrow from E (the older shadow root) to V (the younger shadow root) in Fig 5 in the spec, 1, this result might look natural.

The long answer is:
Let me prepare a document how we should view multiple shadow roots. I briefly explained it in comment #187, however, I need to explain further.

You might notice that the modified Fig 5 is similar to a Fig 1, [2], which explains a tree of trees. Ignore dotted arrows there. Just focus the non-dotted arrows.
There, we can view the fig as follows:

  • "shadow root in C hosts D"
  • "shadow root in D hosts E"

Yes, we can remove "Multiple" from our head.

If an element A hosts multiple shadow roots, [B, C, D], where B is the oldest shadow root and D is the youngest shadow root, we can view this "Multiple shadow roots" as follows:

  • An element, A, hosts a shadow root, B
  • The shadow root, B, hosts another shadow root, C.
  • The shadow root, C, hosts another shadow root, D.

I found that if we can view multiple shadow roots in this way, we could make a lot of things much cleaner and simpler. That's the motivation why I defined a tree of trees as the current spec defines.

I'll update this thread when I write a document, which wouldn't be long one, I guess.

1 Shadow DOM spec Fig. 5: http://w3c.github.io/webcomponents/spec/shadow/index.htmlfig-an-example-tree-of-trees.-nodes-which-are-not-involved-in-the-example-event-path-which-is-explained-later-are-omitted.x

[2] Shadow DOM spec Fig. 1: http://w3c.github.io/webcomponents/spec/shadow/index.html#fig-a-tree-of-trees.x


comment: 192
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c192
Koji Ishii wrote on 2015-04-21 05:04:27 +0000.

Finished analyzing the test results, here are two differences from current/candidates algorithms.

  1. As Hayato explained in the comment #191, older shadow roots are moved from "before the IP they're distributed to" to "after younger shadow roots".

D,C,M,L,R,Q,P,O,N,K,J,I,H,G,U,T,S,F,E,X,W,V,B,A
D,C,M,L,R,Q,P,O,N,K,J,I,H,G,U,T,S,F,X,W,V,E,B,A

  1. Older shadow roots that were not in the path are now included. Two examples below, when event target is "div <-- target", SR-OLDEST and SR-OLDER are now included.

HOST
div <-- target
SR-OLDEST
div
SR-MIDDLE
content
SR-YOUNGEST
shadow

HOST
SR-OLDER
SR-YOUNGER
shadow
div <-- target

I'm fine with either algorithm; both makes each own logical sense, do not break the principal rules, and technically correct (2nd diff above needs confirmation from Hayato though.)

I think the most valuable thing at this point is to stabilize the algorithm and make implementations interoperable. Hope the WG resolves this issue this week.


comment: 193
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c193
Hayato Ito wrote on 2015-04-22 00:37:42 +0000.

Thank you for analyzing.

(In reply to Koji Ishii from comment #192)

Finished analyzing the test results, here are two differences from
current/candidates algorithms.

  1. As Hayato explained in the comment #191, older shadow roots are moved
    from "before the IP they're distributed to" to "after younger shadow roots".

D,C,M,L,R,Q,P,O,N,K,J,I,H,G,U,T,S,F,E,X,W,V,B,A
D,C,M,L,R,Q,P,O,N,K,J,I,H,G,U,T,S,F,X,W,V,E,B,A

  1. Older shadow roots that were not in the path are now included. Two
    examples below, when event target is "div <-- target", SR-OLDEST and
    SR-OLDER are now included.

HOST
div <-- target
SR-OLDEST
div
SR-MIDDLE
content
SR-YOUNGEST
shadow

HOST
SR-OLDER
SR-YOUNGER
shadow
div <-- target

Both are expected to me. Unless there is a use case where this causes a trouble, I'm okay to have this behavior. This behavior is fine because I think we shouldn't skip an intermediate node tree in a tree of trees in dispatching an event.

A node trees which are involved in dispatching an event should be connected, I think.


comment: 194
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c194
Hayato Ito wrote on 2015-04-22 00:40:11 +0000.

As a follow-up for comment #191, I've written a draft doc about multiple shadow roots: https://github.com/w3c/webcomponents/wiki/Multiple-Shadow-Roots-as-%22a-Shadow-Root-hosts-another-Shadow-Root%22


comment: 195
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c195
Olli Pettay wrote on 2015-04-23 16:26:03 +0000.

(In reply to Koji Ishii from comment #192)

Finished analyzing the test results, here are two differences from
current/candidates algorithms.

  1. As Hayato explained in the comment #191, older shadow roots are moved
    from "before the IP they're distributed to" to "after younger shadow roots".

D,C,M,L,R,Q,P,O,N,K,J,I,H,G,U,T,S,F,E,X,W,V,B,A
D,C,M,L,R,Q,P,O,N,K,J,I,H,G,U,T,S,F,X,W,V,E,B,A

And that is the issue. Now older shadow trees would have all the power to
affect whether event even enters to younger tree (by using capturing listeners),
but from rendering point of view the younger tree is still the parent of the older.
In my mind the older tree is always distributed to , which means that
older shadow root is the connecting link between the older shadow tree and the
in the younger one.
In other words "shadow hosts" the older tree.


comment: 196
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23887#c196
Hayato Ito wrote on 2015-04-27 04:53:21 +0000.

Update: I and Olli chatted at Web Components f2f. We concluded that there was no remaining issue, given that Multiple Shadow Roots will be removed.

I think "hayato-2014-5" will work "as is" in a world without "Multiple Shadow Roots", though let me keep this open until I update the current event path for the world without Multiple Shadow Roots.

[Shadow]: Consider a notion of shared stylesheet (bugzilla: 15818)

Title: [Shadow]: Consider a notion of shared stylesheet (bugzilla: 15818)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15818


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15818#c0
Dimitri Glazkov wrote on 2012-01-31 23:04:34 +0000.

Having scoped styles is cool, but having a designated stylesheet that's shared among a set of shadow DOM subtrees has more potential for better performance and ease of use.


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15818#c1
Dominic Cooney wrote on 2012-02-01 06:52:03 +0000.

There's a similar problem when using shadow DOM to implement widgets--the shadow DOM of all instances of the widget need to be populated with a copy of the same DOM structure.

So it seems like there is overlap: Implementations could implement a lightweight copy-on-write clone of <style scoped> and handle the styling with the cloning of the rest of the widget DOM.

The benefit of the shared stylesheet would be that it would be possible to share a stylesheet for different kinds of widgets (buttons and sliders, etc.)

Would it be crazy to make style resolution for shadow DOM follow where these DOMs were defined? e.g. in the case of some future "custom element" spec:

    <div>
    <style scoped>
    ... definitions for the set of widgets ...
    </style>
    <div>
      <style scoped>
        ... definitions for the clickable widgets ...
      </style>
      <element name="x-button">
        <style scoped>
          ... definitions for the button ...
        </style>
        <template>
          ...
        </template>
      </element>
      <element name="x-checkbox">
        <style scoped>
          ... definitions for the checkbox ...
        </style>
        ...
    </div>
    ... other kinds of widgets ...
    </div>

comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15818#c2
Dimitri Glazkov wrote on 2012-03-14 22:15:17 +0000.

Here's what I am thinking.

At Shadow DOM spec level, we add a new, simple API to add a stylesheet to ShadowRoot. This stylesheet will be explicitly read-only (no CSSOM):

ShadowRoot.addStylesheet(url);
ShadowRoot.removeStylesheet(url);

Maybe it's a Map of some read-only CSSStyleSheet objects?

This will allow authors pretty nice level of control over shared stylesheets.

At the Custom Element spec level, we will need to come up with some sort of syntax to specify these shared stylesheets as URLs. Maybe:

...

or something along the lines of Dominic's idea.

Travis, Tony, Anne (as the former CSSOM editor) -- what do you think?


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15818#c3
Travis Leithead [MSFT] wrote on 2012-03-15 20:29:19 +0000.

(Replying for Tony as he just had a new baby :)

I think this is definately a step in the right direction as compared with <style scoped>.

It gives the component author a chance to exclusively share stylesheet objects, which is great, and the implementation a chance to optimize around that shared instance (rather than having multiple copies of a scoped stylesheet hanging around).

There may be some room to further refine this, but as mentioned, this is definately a step up.


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15818#c4
Dimitri Glazkov wrote on 2012-05-15 19:58:23 +0000.

I decided to punt this to post-first WD.


comment: 5
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15818#c5
Tony Ross [MSFT] wrote on 2012-07-31 23:47:09 +0000.

I'd prefer to keep the read-write nature of the CSS OM here if we can. That way a component author can apply tweaks to the core stylesheet dynamically which affect all shadow DOM subtrees referencing that stylesheet.

Also rather than passing an URL, what about passing a reference to an actual or <style> element? This aligns more closely with the proposal for custom elements while providing a bit more flexibility for dynamic generation (e.g. if a framework wanted to inline all CSS as part of their JS file, then build out a <style> element at runtime).


comment: 6
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15818#c6
Dimitri Glazkov wrote on 2012-08-01 16:39:11 +0000.

(In reply to comment #5)

I'd prefer to keep the read-write nature of the CSS OM here if we can. That way
a component author can apply tweaks to the core stylesheet dynamically which
affect all shadow DOM subtrees referencing that stylesheet.

Also rather than passing an URL, what about passing a reference to an actual

or <style> element? This aligns more closely with the proposal for custom elements while providing a bit more flexibility for dynamic generation (e.g. if a framework wanted to inline all CSS as part of their JS file, then build out a <style> element at runtime).

Yes, I am leaning toward this as well.


comment: 7
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15818#c7
Dimitri Glazkov wrote on 2012-08-01 21:09:31 +0000.

Ok, what do you think? http://dvcs.w3.org/hg/webcomponents/rev/1456fe73dfb0


comment: 8
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15818#c8
Dimitri Glazkov wrote on 2012-08-02 19:43:54 +0000.

Please reopen if you feel the API is bad or file new bugs to tweak it.


comment: 9
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15818#c9
Steve Orvell wrote on 2013-07-02 03:43:06 +0000.

Reopening this bug because the proposed edit to the spec to contain addStyleSheet is not currently in the spec.

What happened to it? Was it abandoned in favor of another idea?


comment: 10
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15818#c10
Dimitri Glazkov wrote on 2013-07-02 03:46:38 +0000.

They were removed in bug 21923. Do we need them?


comment: 11
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15818#c11
Steve Orvell wrote on 2013-07-02 04:18:04 +0000.

I think there are 2 issues here that still need consideration. Perhaps we need a separate bug for the second one?

  1. There should be a way to share styling such that the author can define the styles once and use them in multiple shadowRoots.
  2. There should be a way to use an external stylesheet (link rel="stylesheet") with a shadowRoot.

comment: 12
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15818#c12
Dimitri Glazkov wrote on 2013-07-02 16:00:08 +0000.

(In reply to comment #11)

I think there are 2 issues here that still need consideration. Perhaps we
need a separate bug for the second one?

Sounds good.

  1. There should be a way to share styling such that the author can define
    the styles once and use them in multiple shadowRoots.
  2. There should be a way to use an external stylesheet (link
    rel="stylesheet") with a shadowRoot.

Also adding wchen, mrbkap, who are working on this at Mozilla.


comment: 13
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15818#c13
Steve Orvell wrote on 2013-07-02 16:20:21 +0000.

Bug for loading stylesheets via link rel="stylesheet":

https://www.w3.org/Bugs/Public/show_bug.cgi?id=22539

[Shadow]: <content> usage in a place where non-flow content is expected (bugzilla: 22107)

Title: [Shadow]: usage in a place where non-flow content is expected (bugzilla: 22107)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22107


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22107#c0
Yuta Kitamura wrote on 2013-05-21 08:06:43 +0000.

Probably related to bug 15616.

In Section 10.4, "Context" of content element reads:
"Where flow content is expected."

However, element should be able to appear in a place where non-flow
content is expected. Actually, an example in Section 11 illustrates such cases:

<div class="breaking">
    <ul>
        <!-- The content model of <ul> is "zero or more li elements",
             which is NOT flow content. Therefore, the <content> below
             is non-conformant. -->
        <content select=".breaking"></content>
    </ul>
</div>
and have special content model like
    , so if appears directly under these elements, they become non-conformant (which should be unexpected).

    The definition of element (in Section 10.5) has the exact same issue.


    comment: 1
    comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22107#c1
    Dimitri Glazkov wrote on 2015-04-23 18:54:48 +0000.

    Doesn't need to block v1, nice-to-have.

[Shadow]: Node should expose their scope so that shared state can be scoped to components. (bugzilla: 22080)

Title: [Shadow]: Node should expose their scope so that shared state can be scoped to components. (bugzilla: 22080)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22080


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22080#c0
Rafael Weinstein wrote on 2013-05-18 00:15:53 +0000.

It's not hard to imagine collection of elements working together and looking for each other within the same context.

ShadowRoot has getElementById and querySelectorAll on it, partially for this purpose.

Obviously, nodes can always walk up to the root element and inspect it to see if it's a document or ShadowRoot.

I propose that node should expose some time of treeScope property which is trivial checked. The C++ impl may walk up itself, and that's fine.

My main concern is components will be littered with implementations of findRoot(), or more likely, component authors scope shared state globally, either via window or document.

I.e. The main motivation would be encouraging proper encapsulation. If implementations can return the answer in constant time, that's just a bonus.


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22080#c1
Dimitri Glazkov wrote on 2013-05-20 16:32:57 +0000.

I am a bit hesitant to expose this whole guts of plumbing, given that TreeScope is uninteresting in itself. I wonder if we could get away with just letting any element find out which ShadowRoot it belongs to in O(1)?


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22080#c2
Rafael Weinstein wrote on 2013-05-20 17:11:40 +0000.

What's the difference?

The general point is that a node may wake up and want to know what tree it is in. In general elements should be tolerant of being in the main document or being in the shadow of another element.

The basic goal here is to formalize the way that elements can figure out "who is my root thingy" without boilerplate of findRoot() littered all over.


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22080#c3
Dominic Cooney wrote on 2013-05-21 02:20:04 +0000.

The good thing about adding something that returns the ShadowRoot is that it is easy to write:

if (in document) {
behave
} else if (in shadow) {
misbehave
} ...

But it makes it harder to write "do something to my root node"; instead of

elem.treeScope.party();

it is

(elem.containingShadow || elem.document).party();

I think having the shadow root accessor is better because it is very easy to explain. Otherwise we'll have to put this pop quiz on cereal packets:

What does elem.treeScope return when...
...elem is not in the tree? (null)
...elem is in light DOM? (document)
...elem is in template content? (template document, I guess?)
...elem is in shadow DOM? (Shadow Root)
...elem is in a document fragment? (???)


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22080#c4
Rafael Weinstein wrote on 2013-05-23 23:16:56 +0000.

I can't tell if we're talking at cross purposes or not. I'm probably just being dense.

The point I'm trying to make is that, for the sake of encapsulation, I think it makes the most sense to think about being directly descended from a ShadowRoot like being in a "little" document.

The key question that the node needs to answer is: "which document-like thing am I inside, if any". If I'm not inside any, there's nothing to do, if I'm inside one, I may go looking for local (encapsulated) shared or configuration data at that document-like thing (the root of my encapsulated context).

This seems only natural to me. Maybe I'm suggesting that we need a need Interface which implemented getElementById and both Document and ShadowRoot implement that interface. node.treeScope would then return that interface if the node had one.

To answer the questions above:

What does elem.treeScope return when...
...elem is not in the tree? (null)
...elem is in light DOM? (document)
...elem is in template content? (null)
...elem is in shadow DOM? (Shadow Root)
...elem is in a document fragment? (null)

The point is that ShadowRoots essentially become local documents. I claim this is inline with the web components mantra of enabling local thinking.


comment: 5
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22080#c5
Hayato Ito wrote on 2014-05-29 06:30:26 +0000.

This issue looks a little outdated.

I'm not sure whether this API, such as node.treeScope, is worth adding or not.

Does someone have still a strong interest on this?


comment: 6
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22080#c6
Rafael Weinstein wrote on 2014-05-29 18:05:21 +0000.

I think it's fine to leave as a potential future feature when use cases are more clear


comment: 7
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22080#c7
Hayato Ito wrote on 2014-12-12 06:08:22 +0000.

Let me keep this open.

For me, comment #4 sounds reasonable. I don't have any reason to object to this feature request. I am wondering why this feature request has not had another +1 from others?

I guess other guys hasn't discovered this feature request, or they all are satisfied with their *polyfill. Hmm.

If someone want to this strongly, please let us know that.


comment: 8
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22080#c8
Hayato Ito wrote on 2014-12-15 09:03:21 +0000.

Looks like that developers are making a polyfill for this issue:

http://stackoverflow.com/questions/27453617/how-can-i-tell-if-an-element-is-in-a-shadow-dom

I don't think this is a good situation because a polyfill might take O(N) while the platform can answer that in O(1).

I am positive to add a node.scope or something else. Could we agree on this?

[Shadow]: Inheritance Model for Shadow DOM (bugzilla: 28587)

Title: [Shadow]: Inheritance Model for Shadow DOM (bugzilla: 28587)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28587


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28587#c0
Hayato Ito wrote on 2015-04-30 16:23:15 +0000.

Let me file a bug so that we can track the progress about "Inheritance Model for Shadow DOM".

See the relevant discussion: https://lists.w3.org/Archives/Public/public-webapps/2015AprJun/0371.html

[Shadow]: Add support for external stylesheets using link rel="stylesheet" (bugzilla: 22539)

Title: [Shadow]: Add support for external stylesheets using link rel="stylesheet" (bugzilla: 22539)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22539


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22539#c0
Steve Orvell wrote on 2013-07-02 16:19:39 +0000.

It is, of course, possible to use external stylesheets within a <style> element via @import-(migrated-from-bugzilla-to-avoid-pinnging-users-in-github). The spec should consider adding support also for including stylesheets via link rel="stylesheet" because:

  1. it's simpler
  2. it's familiar
  3. to avoid possible negative characteristics of @import-(migrated-from-bugzilla-to-avoid-pinnging-users-in-github): https://developers.google.com/speed/docs/best-practices/rtt#AvoidCssImport

comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22539#c1
Steve Orvell wrote on 2013-07-02 16:23:46 +0000.

We should be able to dimiss point #3 since we're comparing link rel="stylesheet" to:

<style> @import-(migrated-from-bugzilla-to-avoid-pinnging-users-in-github) url(sheet.css); </style>

comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22539#c2
Dimitri Glazkov wrote on 2013-07-17 16:48:48 +0000.

*** Bug 19276 has been marked as a duplicate of this bug. ***


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22539#c3
Hayato Ito wrote on 2014-05-29 08:46:11 +0000.

Hi Steve, is this feature request still valid?

I think this feature request makes sense. Looks reasonable to me.


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22539#c4
Dimitri Glazkov wrote on 2014-05-29 16:02:15 +0000.

Just as an idea: can we look at how this would desugar into an imperative API?

Elliott had this notion of:

var stylesheet = new CSSStyleSheet(url);
root.stylesheets.add(stylesheet).

Is this basically it?


comment: 5
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22539#c5
Steve Orvell wrote on 2014-05-29 16:37:41 +0000.

I agree with Dimitri and he has a good basic summary.

We need to resolve the fetching issues with using remote stylesheets in shadowRoots before adding any new behavior, and the imperative api Dimitri outlined should address this.

The basic problem is that if a style element that has remote content (@import-(migrated-from-bugzilla-to-avoid-pinnging-users-in-github)) is added to a shadowRoot, the remote content is fetched. Imagine that an author wants to create N shadowRoots. The author uses the best practice of putting style elements inside shadowRoot but wants to use a remote stylesheet in each one. This currently requires N network requests, even if there is only 1 referenced remote stylesheet.

The idea behind root.stylesheets.add(stylesheet) is that you can apply a stylesheet to a shadowRoot without causing it to re-fetch or parse.


comment: 6
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22539#c6
Hayato Ito wrote on 2014-05-30 05:02:10 +0000.

Thank you. That looks very reasonable argument and looks very important from the view of the performance. Totally agreed.

(In reply to Steve Orvell from comment #5)

I agree with Dimitri and he has a good basic summary.

We need to resolve the fetching issues with using remote stylesheets in
shadowRoots before adding any new behavior, and the imperative api Dimitri
outlined should address this.

The basic problem is that if a style element that has remote content
(@import-(migrated-from-bugzilla-to-avoid-pinnging-users-in-github)) is added to a shadowRoot, the remote content is fetched. Imagine
that an author wants to create N shadowRoots. The author uses the best
practice of putting style elements inside shadowRoot but wants to use a
remote stylesheet in each one. This currently requires N network requests,
even if there is only 1 referenced remote stylesheet.

The idea behind root.stylesheets.add(stylesheet) is that you can apply a
stylesheet to a shadowRoot without causing it to re-fetch or parse.

[Shadow]: Distribution needs to not be observable (bugzilla: 27994)

Title: [Shadow]: Distribution needs to not be observable (bugzilla: 27994)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27994


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27994#c0
Anne wrote on 2015-02-10 15:35:35 +0000.

"If any condition which affects the distribution result changes, the distribution result must be updated before any use of the distribution result."

It seems both layout and events make use of the distribution result. That would be worth mentioning I think to make it clear what the observable bits are.

However, if events make use of them, wouldn't we be able to work out when distribution happens by firing synthetic events?

And how does this work for ranges that can reach into the shadow DOM? Wouldn't we get problems there too with how deterministic things are?


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27994#c1
Dimitri Glazkov wrote on 2015-02-10 17:00:18 +0000.

There's a bit more discusson here: https://soundcloud.com/dglazkov/polymer-master


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27994#c2
Dimitri Glazkov wrote on 2015-02-10 17:12:30 +0000.

(In reply to Dimitri Glazkov from comment #1)

There's a bit more discusson here:
https://soundcloud.com/dglazkov/polymer-master

Doh. https://gist.github.com/dglazkov/ce96f673b0b2ce7b8c55


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27994#c3
Anne wrote on 2015-04-23 21:09:52 +0000.

See also bug 28443 which discusses this very same issue.


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27994#c4
Anne wrote on 2015-04-27 05:45:56 +0000.

This might be moot if we get an API.

Define the timing when distribution happens

Title: [Shadow]: Specify distribution in terms of event loop (bugzilla: 28443)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28443


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28443#c0
Dimitri Glazkov wrote on 2015-04-08 15:58:31 +0000.

From https://lists.w3.org/Archives/Public/public-webapps/2015AprJun/0052.html

Currently, the spec is not very precise about when distribution happens:

"If any condition which affects the distribution result changes, the distribution result must be updated before any use of the distribution result."

This results in difficulty for interoperability, as the exact timing of when affects change is hard to reason across browsers.

Instead, it needs to define when exactly the distribution algorithm runs. For example, we could have tied it to the timing of style calculation, because distribution algo always runs before style calculation.

Is the timing of style calculation specified?

[Shadow]: Specify imperative API for node distribution (bugzilla: 18429)

Title: [Shadow]: Specify imperative API for node distribution (bugzilla: 18429)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=18429


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=18429#c0
Dimitri Glazkov wrote on 2012-07-27 22:19:33 +0000.

Declarative insertion points syntax is not able to address several use cases (spec bugs to be filed by Hayato-san and Shinya-san). Here's a strawman for an imperative API:

The general idea is that the insertion point distribution is actually something that occurs as a result of running some function/callback. The callback could be powered with Mutation Observers, or some internal implementation. When this function runs, it operates on a special API of HTMLContentElement: the distributedChildren (name TBD) array.

Adding a Node to this array makes it appear projected into its HTMLContentElement. If a node is not a descendant of shadow host, an exception is thrown. If a node is a descendant of another node that is already a member of any distributedChildren array of the shadow subtree, that other node is ejected from the distributedChildren array to which it belonged. There are more cases to handle, but you get the gist.

The declarative API is simply a byproduct of some default function/callback. You can override this callback with your custom handler, thus disabling the declarative API.

The advantage here is that you can:

  1. completely explain the magic of the declarative insertion point syntax

  2. provide solutions to all of the use cases (including crazy stuff like dynamic creation of insertion points for varying number of children)

The disadvantage is that:

  1. the API has tremendous foot-gun potential and we need to make darn sure to steer clear of those.

  2. there are potential challenges with making this work in a performant fashion.


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=18429#c1
Dimitri Glazkov wrote on 2014-02-11 18:48:15 +0000.

We still need the imperative API. It just needs to be addressed at the level of the underlying primitives and with proper layering.


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=18429#c2
Dimitri Glazkov wrote on 2014-03-07 18:39:46 +0000.

There's an API proposed on http://lists.w3.org/Archives/Public/public-webapps/2014JanMar/0376.html. It needs a small tweak to play nice with distributions.

Distributions are necessary to maintain composability properties of Shadow DOM. Since it might be hard for a newcomer to reconstruct the whole picture from emails and bug comments, I took a bit of time to document it here: https://gist.github.com/dglazkov/e8402f9ab18ad7ef2e7d

tl;dr: distributions are a requirement for Shadow DOM. They are here to stay, because without them, Shadow DOM is just a fun theoretical exercise.

The tweak is minor: the add/remove methods populate a pool of candidates. We then hook processing this pool into pool population algorithm (http://w3c.github.io/webcomponents/spec/shadow/#dfn-pool-population-algorithm), modulo additional integrity checks (tbd). Even better, make this pool of candidates an Array.

This eliminates both the problem with the original proposal, and makes the recently proposed API work with distributions.


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=18429#c3
Dimitri Glazkov wrote on 2014-04-10 17:30:31 +0000.

Here's a brainstorm gist for F2F session tomorrow.

https://gist.github.com/dglazkov/ce96f673b0b2ce7b8c55


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=18429#c4
Hayato Ito wrote on 2014-04-11 01:32:25 +0000.

Inspired from the Dimitri's gist, here is yet another idea.
This is a kind of the mixture of 'Passive candidate array' and 'Selector-based Routing'.
I'd have to say that this is a very rough idea.

Given the same DOM tree from the gist,

// Make sure that contentSummaryUI selects 'all' from the pool.
contentSummaryUI.setAttribute('select', '*')
contentSummaryUI.getDistributedNode()
[firstSummary,

]

// New API for insertion point: addDistributionCandidate(shadow_host, selector)
// addDistributionCandidate(..., ...) takes a shadow host and "selector" expression to select nodes from the children of the shadow host.
var distributionCandidate1 = contentSummaryUI.addDistributionCandidate(div, "summary:first-of-type");

// Supports also specifying a distributed node directly???
// var distributionCandidate1 = contentSummaryUI.addDistributionCandidate(firstSummary);

contentSummaryUI.distributionCandidates()
[distributionCandidate1]

// If an insertion point has a non-empty distributionCandidates, the pool is populated from the list of candidates.

contentSummaryUI.getDistributedNodes()
[firstSummary]

Does DistributionCandidate have an API?
distributionCandidate1.nodes()
[firstSummary]

contentSummaryUI.removeDistributionCandidate(distributionCandidate1)
contentSummaryUI.distributionCandidates()
[]
contentSummaryUI.getDistributedNodes();
[firstSummary,

]


comment: 5
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=18429#c5
Dimitri Glazkov wrote on 2015-02-07 00:32:37 +0000.

I just looked at this with fresh eyes and realized that I could polyfill an imperative API by using classes and matching their names to those of insertion points:

http://jsbin.com/baholi/3/edit?html,js,output


comment: 6
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=18429#c6
Dimitri Glazkov wrote on 2015-03-06 23:49:47 +0000.

(In reply to Dimitri Glazkov from comment #5)

I just looked at this with fresh eyes and realized that I could polyfill an
imperative API by using classes and matching their names to those of
insertion points:

http://jsbin.com/baholi/3/edit?html,js,output

Of course, it doesn't work with distributions :`(


comment: 7
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=18429#c7
Hayato Ito wrote on 2015-04-27 03:09:48 +0000.

Let me move this bug to V2, assuming this is not a blocker for V1.


comment: 8
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=18429#c8
Anne wrote on 2015-04-27 03:20:19 +0000.

Hayato, what would we do in v1? I think we concluded that since both and were not working for everyone involved, we needed to do imperative distribution first.


comment: 9
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=18429#c9
Hayato Ito wrote on 2015-04-27 03:32:57 +0000.

(In reply to Anne from comment #8)

Hayato, what would we do in v1? I think we concluded that since both
and were not working for everyone involved,
we needed to do imperative distribution first.

Yeah, imperative API is a stretch goal for v1, isn't it?

I'm okay to have a stretch goal under v1 umbrella. Let me move this back to v1.

We can decide to have the imperative APIs for v1 after July 13.


comment: 10
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=18429#c10
Anne wrote on 2015-04-27 05:37:01 +0000.

I think that without an imperative API we're back to vs and likely no closer to reaching agreement to ship. So my goal is to get the imperative API done.


comment: 11
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=18429#c11
Hayato Ito wrote on 2015-04-27 07:18:48 +0000.

Thanks. I'm still uncertain, but let me contribute to the imperative API well and see how we can.

I really hope the discussion will be done in this bug. :)


comment: 12
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=18429#c12
Hayato Ito wrote on 2015-04-27 21:46:25 +0000.

The relevant discussion on public-webapps@

https://lists.w3.org/Archives/Public/public-webapps/2015AprJun/0288.html


comment: 13
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=18429#c13
Hayato Ito wrote on 2015-04-30 14:36:05 +0000.

For reference, could someone add a link to known use cases for an imperative API in this discussion?

I'd like to know every use cases we'd like to support in an imperative API.

'in a Document' for shadow trees

Title: [Shadow]: Need an equivalent definition of 'in a Document' for shadow trees (bugzilla: 26365)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c0
Hayato Ito wrote on 2014-07-17 04:13:53 +0000.

The context is:

https://code.google.com/p/chromium/issues/detail?id=393350
https://code.google.com/p/chromium/issues/detail?id=394327

According to the current definition of a 'in a Document' 1, some important features, such as scripting, should not work in shadow trees as per the spec.

Because I am afraid that it's not a good idea to change the definition of 'in a Document', we need a better terminology for alternative of 'in a Document', such as 'in a Document or in a shadow tree', and should fix the relevant specs by using that.


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c1
Boris Zbarsky wrote on 2014-07-17 05:25:53 +0000.

such as 'in a Document or in a shadow tree'

That's wrong if the shadow host in the light DOM is not in a document.

What are the cases in which you'd want different behavior between "in a Document" and whatever your new concept is?


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c2
Hayato Ito wrote on 2014-07-17 05:56:31 +0000.

(In reply to Boris Zbarsky from comment #1)

such as 'in a Document or in a shadow tree'

That's wrong if the shadow host in the light DOM is not in a document.

What are the cases in which you'd want different behavior between "in a
Document" and whatever your new concept is?

I think that should be 'in a composed tree whose root element is a Document'.
That's still a tentative idea, though.


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c3
Boris Zbarsky wrote on 2014-07-17 06:01:05 +0000.

Yes, but what will break if the definition of "in a Document" is changed to mean that (with s/element/node/, I assume).


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c4
Hayato Ito wrote on 2014-07-17 06:10:44 +0000.

(In reply to Boris Zbarsky from comment #3)

Yes, but what will break if the definition of "in a Document" is changed to
mean that (with s/element/node/, I assume).

Ops. An aggressive idea! I can't predict the impact of this change, however, I like it. :) That should be no impact, I hope.

I just thought that there are some cases where we want to distinguish 'in a Document' and 'in a composed tree whose root is a Document'.


comment: 5
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c5
Olli Pettay wrote on 2014-07-17 09:41:05 +0000.

I would start with shadow DOM being not-in-document by default and then case by
case verify that if the host is in doc how various features should work.
Otherwise we may easily accidentally leak internals of shadow dom to the
outside worlds, like in case of https://code.google.com/p/chromium/issues/detail?id=394332


comment: 6
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c6
Boris Zbarsky wrote on 2014-07-17 12:35:11 +0000.

That should be no impact, I hope.

This isn't something to hope; this is something to audit in the specs; comes with changing the fundamental conceptual model...

That said, one of the very first hits on "in a Document" in HTML is in "reset the form owner", and in that case it's not clear to me that things inside a shadow DOM should be considered "in a document".

So it does sound like shadow DOM should not be "in a document" by default but we need a new term X for "light DOM nodes are X if in a document, shadow DOM nodes are X if shadow host is X" that other specs then need to be adjusted to use. That means filing spec bugs on those specs.

Normally this would happen either during specification or implementation; it's a bit disturbing to me that neither one happened here so far until we started implementing, since it suggests Chrome wasn't actually implementing what the spec says. :(


comment: 7
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c7
Hayato Ito wrote on 2014-07-18 03:38:29 +0000.

Yet another related issue:
https://code.google.com/p/chromium/issues/detail?id=394295


comment: 8
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c8
Hayato Ito wrote on 2014-07-18 03:53:31 +0000.

One more:
https://code.google.com/p/chromium/issues/detail?id=394307

Once we can resolve the spec bug, blink guys should triage these relevant bugs.


comment: 9
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c9
Hayato Ito wrote on 2014-07-18 04:40:32 +0000.

(In reply to Boris Zbarsky from comment #6)

That should be no impact, I hope.

This isn't something to hope; this is something to audit in the specs; comes
with changing the fundamental conceptual model...

That said, one of the very first hits on "in a Document" in HTML is in
"reset the form owner", and in that case it's not clear to me that things
inside a shadow DOM should be considered "in a document".

So it does sound like shadow DOM should not be "in a document" by default
but we need a new term X for "light DOM nodes are X if in a document, shadow
DOM nodes are X if shadow host is X" that other specs then need to be
adjusted to use. That means filing spec bugs on those specs.

Agreed on that we should proceed in a careful way. We must audit the usage of 'in a Document' in specs, right?
That might not be an easy task. However, I am sure we can agree that we should be careful here.

I think we have to distinguish the following cases:

  1. A node is In a Document.
  2. A node is *in a composed tree whose root is a Document.
  3. A node is In a Document, but not in a composed tree whose root is a Document.
    (That means there is a state where node is in 1, but not in 2, such as a node which is a child of a shadow host, but it's not distributed.)

We might want to have a new TERM x to represents the state of 2 (and 3?).


comment: 10
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c10
Hayato Ito wrote on 2014-07-18 07:18:49 +0000.

I think the previous classification is not good. The following might be better:

(1): A node is in a Document. The meaning of this doesn't change.

(2): A node is in a shadow tree which participates in a tree of trees whose root tree is a document tree.

(3): (1) or (2). We might want to call it, "A node is in a tree of trees rooted by a Document".

(4). A node is in a composed tree whose root is a Document.
Note that a node can be ((3), but not in (4)) when a node is a child of a shadow host, but the node isn't distributed to anywhere.


comment: 11
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c11
Olli Pettay wrote on 2014-09-19 11:49:10 +0000.

I don't understand the difference between 3 and 4.
"A node is in a tree of trees rooted by a Document" vs
"A node is in a composed tree whose root is a Document"


comment: 12
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c12
Ian 'Hixie' Hickson wrote on 2014-09-20 01:19:07 +0000.

First step here seems to me to be to enumerate all the cases we care about.


comment: 13
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c13
Hayato Ito wrote on 2014-09-22 01:27:00 +0000.

(In reply to Olli Pettay from comment #11)

I don't understand the difference between 3 and 4.
"A node is in a tree of trees rooted by a Document" vs
"A node is in a composed tree whose root is a Document"

For example, the following codes could be in (3), but not in (4):

  • A node is a child node of a shadow host, but the node is not distributed to any insertion points.
  • A node is in the older shadow tree, but the younger shadow tree doesn't have element.
  • A node is a child of content insertion points.

These nodes couldn't participate in the composed tree.


comment: 14
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c14
Hayato Ito wrote on 2014-09-22 01:27:58 +0000.

For example, the following codes could be in (3), but not in (4):

s/codes/nodes/


comment: 15
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c15
Hayato Ito wrote on 2014-09-22 01:34:54 +0000.

(In reply to Ian 'Hixie' Hickson from comment #12)

First step here seems to me to be to enumerate all the cases we care about.

Yeah, I agree.

We have to enumerate all cases where "in a Document" is being used in relevant specs and have to make a decision whether we can leave the usage of "in a Document" as is or replace the usage with better terminology, which we haven't had yet. :(


comment: 16
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c16
Olli Pettay wrote on 2014-09-22 09:41:16 +0000.

(In reply to Hayato Ito from comment #13)

For example, the following codes could be in (3), but not in (4):

  • A node is a child node of a shadow host, but the node is not distributed
    to any insertion points.
  • A node is in the older shadow tree, but the younger shadow tree doesn't
    have element.
  • A node is a child of content insertion points.

These nodes couldn't participate in the composed tree.

I see. In Gecko we're going to make, at least for now until the spec
is clarified, nodes in a shadow host, but not distributed, to behave
like it was in a disconnected subtree.


comment: 17
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c17
Ian 'Hixie' Hickson wrote on 2014-09-26 18:29:23 +0000.

So who is going to go through and file the bugs for the relevant cases? I don't know Web Components well enough to do this myself.


comment: 18
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c18
Ian 'Hixie' Hickson wrote on 2014-09-26 18:36:11 +0000.

Seems like this should include cases like how radio buttons pick their radio button group, how scripts decide if they should execute (and if they do, whether document.currentScript is the right API to update when they execute), how labels decide what controls they are labelling, how getElementById() and getElementsByTagName() work, whether iframes should load in shadow trees, what gets included in APIs like document.links, how image maps are found, how target=""s are found, etc.

This seems pretty critical.


comment: 19
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c19
Hayato Ito wrote on 2014-09-29 06:38:51 +0000.

(In reply to Ian 'Hixie' Hickson from comment #17)

So who is going to go through and file the bugs for the relevant cases? I
don't know Web Components well enough to do this myself.

I thought I had to do. I guess I'd need help from experienced spec editors.
This issue has been in my TODO list, however, I couldn't spend my time on this at all so far.

I am aware that this is an important issue, however, to be honest, it's likely that I can't start this task in a few weeks.


comment: 20
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c20
Hayato Ito wrote on 2014-09-30 07:12:10 +0000.

Yeah, this is super critical. How should we proceed? I appreciate advice from experienced spec editors.

Here is very rough current plan how to proceed:

  1. Define good terminologies, as I described in comment 10, so that we can use these terms to update specs.

    This might be important because well defined terminologies would make it easy to update the spec.
    To define a good terminology set, we might want to pick up some concrete examples from currently filed bugs so that the terminology set is really helpful.

  2. Go though specs and file bugs.

    • Which specs should we take care of? DOM and HTML and... maybe all?
    • Should we manage the list of relevant bugs in W3c bugzilla?
      e.g. One master (meta) bug and other relevant bugs which depends on the meta-bug.
  3. Use our best judgement and update the spec in each filed bug.

(In reply to Ian 'Hixie' Hickson from comment #18)

Seems like this should include cases like how radio buttons pick their radio
button group, how scripts decide if they should execute (and if they do,
whether document.currentScript is the right API to update when they
execute), how labels decide what controls they are labelling, how
getElementById() and getElementsByTagName() work, whether iframes should
load in shadow trees, what gets included in APIs like document.links, how
image maps are found, how target=""s are found, etc.

This seems pretty critical.


comment: 21
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c21
Hayato Ito wrote on 2014-10-01 11:37:57 +0000.

Let me share my very rough memo as a basis for discussion.

Let's use the following trees as an example:

Closing tags are being omitted.

HTML:

The node #A hosts three shadow trees as follows, from older to younger:

  1. oldest-shadow-root

    // #older-shadow-root doesn't have a shadow insertion point.
  2. older-shadow-root

  3. youngest-shadow-root

In addition, suppose that we have disconnected nodes as follows:

var o = document.createElement('div');
var p = o.createShadowRoot();

The composed tree will be:

document:

We can classify the nodes as follows:

                                          a b c d e f g h i j k l m n o p

A). In a document x x x x x
B). In a shadow tree x x x x x x x x x X
C). In a composed tree (root is a document) x x x x x
D). In a tree of trees (root is a document) x x x x x x x x x x x x x x
E). Disconnected (from D) x x


comment: 22
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c22
William Chen wrote on 2014-10-02 01:25:14 +0000.

It may also be useful to define a new type of parent/child relation for nodes in composed trees and tree of trees. The terms "parent", "child", "ancestor" and "descendant" may not make sense if we change things from "in document" to "in composed tree rooted at document" or "in tree of trees rooted at document".

Just as an example, one of the steps in the "reset the form owner" algorithm 1 involves finding "the nearest such ancestor form element". If we wanted to allow form-associated-element to associate with forms outside the shadow tree, then the current algorithm isn't sufficient because the parent chain terminates at the shadow root and "nearest ancestor" may not be the node you want.

For "in document" and "in shadow tree", using the current terminology is probably fine.

For "in composed tree" we probably need new terms that describe a parent/child relation between shadow host/shadow root and parent of insertion points/nodes distributed into insertion points. Nodes that are distributed but don't match an insertion point should probably have no parent in this relation.

For "in tree of trees" we would probably also need terms to describe parent/child relation between shadow host/shadow root, but ignore insertion points and distribution.

1 https://html.spec.whatwg.org/multipage/forms.html#reset-the-form-owner


comment: 23
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c23
Hayato Ito wrote on 2014-10-02 10:49:28 +0000.

Good point. Unless otherwise noted, I think parent/child relations for nodes should mean the relation in a document tree or a shadow tree. The meaning shouldn't change.

In regard to 'parent/child relation in composed trees', I've being using 'a parent node in a composed tree', for example, unofficially, in code reviews in chrome. We might want to have a better term.

In regard to 'parent/child relation in a tree of trees', the situation is not so simple. Although I used a term of 'In a tree of trees (root is a document)' in the previous comment, this is a kind of abbreviation for 'In a node tree which participates in a tree of trees whose root tree is a document tree'.

The participant of 'tree of trees' is not a node. That's a node tree.

You might want to know that the spec already have terms, 'child or hosted shadow root' 1 and 'deep descendant' 2.
I've introduced that when I tried to introduce 'deepContains' [3].
I am aware that this definition doesn't define the tree order between sibling nodes in a tree of trees yet.

[3]: That's reverted in 463916e


comment: 24
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c24
Hayato Ito wrote on 2014-10-28 02:08:58 +0000.

Yet another relevant issue in chromium bug tracker: https://code.google.com/p/chromium/issues/detail?id=426050


comment: 25
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c25
Boris Zbarsky wrote on 2014-10-28 02:36:23 +0000.

That's covered by bug 26943, which is blocked on this bug... that was clearly stated in the chromium bug you reference.


comment: 26
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c26
Hayato Ito wrote on 2014-10-31 04:55:43 +0000.

It seems there are a lot of things to todo, however, I think

D). In a tree of trees (root is a document) x x x x x x x x x x x x x x

defining D (with a good naming) clearly in the spec and replace 'In a document' with D where we need to update is a low-hanging fruit and good starting point for us.


comment: 27
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c27
Olli Pettay wrote on 2014-10-31 11:00:36 +0000.

Do f and g actually belong to D. I'd expect f and g to behave as if they were
in a disconnected subtree which has ShadowRoot as the root.
f and g after all don't affect to layout nor participate event propagation path.


comment: 28
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c28
Hayato Ito wrote on 2014-11-06 22:06:18 +0000.

I am okay that we should exclude f and g from D.

That made me think about yet another case. Suppose that node #c (or #d) has a shadow tree, do we consider the shadow tree hosted by #c (or #d) disconnected?

That means the shadow host, #c, itself is not disconnected, but the nodes in the shadow tree hosted by the shadow host, #c, are disconnected. Is it weird?

If you notice any other missing case, please let me know that.

BTW, if someone has a good naming candidate for D, it's highly welcome.


comment: 29
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c29
Olli Pettay wrote on 2014-11-07 10:17:14 +0000.

(In reply to Hayato Ito from comment #28)

That made me think about yet another case. Suppose that node #c (or #d) has
a shadow tree, do we consider the shadow tree hosted by #c (or #d)
disconnected?

The nodes in the shadow tree of #c or #d would be in a composed tree (with document as root), since the host is such tree.
So the shadow dom would be "in composed document" (D).


comment: 30
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c30
Hayato Ito wrote on 2014-11-10 01:46:23 +0000.

No, the actual is:

  • c (or #d) is not in the composed tree (with document as root).

    These nodes are child nodes of the shadow host (#a), however, they are not distributed at all.

  • However, #c (or #d) is "in a document".

A "composed document" (D) might be a good name for D, but I'm afraid that it is confusing name for D because #c (or #d) must belong to D, but #c (or #d) is not in the composed tree (with document as root).

I think "composed document" might be a good name for "C", "composed tree (with document as root), rather.


comment: 31
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c31
Hayato Ito wrote on 2014-11-10 01:49:24 +0000.

A small correction. #c is actually distributed, but it is not in a composed tree (with document as root) because the destination insertion point of #c is in the oldest shadow tree, which is disconnected.

(In reply to Hayato Ito from comment #30)

No, the actual is:

  • c (or #d) is not in the composed tree (with document as root).

    These nodes are child nodes of the shadow host (#a), however, they are not
    distributed at all.

  • However, #c (or #d) is "in a document".

A "composed document" (D) might be a good name for D, but I'm afraid that it
is confusing name for D because #c (or #d) must belong to D, but #c (or #d)
is not in the composed tree (with document as root).

I think "composed document" might be a good name for "C", "composed tree
(with document as root), rather.


comment: 32
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c32
Hayato Ito wrote on 2014-11-10 02:10:52 +0000.

I forgot to express my opinion. The shadow trees hosted by #c (or #d) should be in category D. However, I might change my mind. That's hard for me to categorize it.

This might be a minor issue. What do you think?

Let me make a formal definition for D. That might be helpful for the discussion. I hope a formal definition would help me to understand the problem.


comment: 33
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c33
Hayato Ito wrote on 2014-11-10 04:23:13 +0000.

How about the following definition for category D?

A node, |A|, is 'in a document deeply' (a tentative name until we have a better one) if |A| meets at least one of the following conditions:

  • |A| is in a document
  • |A| is in the youngest shadow tree, |T|, and the shadow host which hosts |T| is 'in a document deeply'
  • |A| is in an older shadow tree, |T|, and the younger shadow tree relative to |T| has a shadow insertion point, |I|, and |I| is 'in a document deeply'

comment: 34
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c34
Hayato Ito wrote on 2014-11-10 06:08:11 +0000.

Yet another idea:

A node, |A| is 'in a document deeply' if |A| is inclusive deep descendant 1 of a document.

That would make things simpler, doesn't that?


comment: 35
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c35
Olli Pettay wrote on 2014-11-10 13:25:26 +0000.

(In reply to Hayato Ito from comment #32)

I forgot to express my opinion. The shadow trees hosted by #c (or #d) should
be in category D.
So we agree here. I said (D) in comment 29.


comment: 36
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c36
Hayato Ito wrote on 2014-11-11 06:32:07 +0000.

Thanks. If we agree that we should include shadow trees hosted by #c in 'D' (aka 'in a document deeply), I am wondering what is the difference between:

  • the shadow tree hosted by #c
    and
  • the oldest shadow tree in the example.

Any node in either tree isn't used in rendering at all (aka they are not in the composed tree (with document as root)), however,

  • Nodes in the shadow tree hosted by #c are 'in a document deeply',
  • Nodes in the oldest shadow trees, such as #f and #g, are not 'in a document deeply'.

That looks inconsistent to me.

Now I am thinking that the proposal in comment #34 is more consistent and even better than the proposal in comment #33 in most cases.
You can see the difference between the two proposals bellow (in the summary). Node #f and #g, which are in the oldest shadow tree, are the difference.

Here is the rationale why I thought proposal 2 (comment #34) is helpful than proposal 1 (comment #33):

I think 'nodes aren't contributing rendering' doesn't matter here because it's like a node with display: none in a document.
My design principle of shadow trees so far is that shadow trees are mainly used to construct one dom tree so that we can separate different concerns to each shadow trees.
Each node in shadow trees are 'in a document', conceptually. Although some nodes don't participate in the composed tree after the composition algorithm, I think we should consider such nodes like a node marked with 'display: none'. That's still in the document (conceptually, again).

Note that if we try to consider the nodes which doesn't participate in the composed tree are not 'in a document deeply', that will fail because node #c (or #d) is in a document, but it doesn't participate in the composed tree (with document as root). We can't adapt this idea because it would break backward-compatibility.

The summary is:

Proposal 1 (in comment #33):

A node, |A|, is 'in a document deeply' if |A| meets at least one of the following conditions:

  • |A| is in a document
  • |A| is in the youngest shadow tree, |T|, and the shadow host which hosts |T| is 'in a document deeply'
  • |A| is in an older shadow tree, |T|, and the younger shadow tree relative to |T| has a shadow insertion point, |I|, and |I| is 'in a document deeply'

The result would be:
(We use the example tree of trees in comment #21 again here. In addition to that, suppose that #c hosts a shadow tree, which contains the node |q|)

                                          a b c d e f g h i j k l m n o p q

A). In a document x x x x x
B). In a shadow tree x x x x x x x x x X X
C). In a composed tree (root is a document) x x x x x
D). In a document deeply x x x x x x x x x x x x X
E). Disconnected (from D) x x x x

Proposal 2 (in comment #34):

A node, |A| is 'in a document deeply' if |A| is inclusive deep descendant 1 of a document.

The result would be:

                                          a b c d e f g h i j k l m n o p q

A). In a document x x x x x
B). In a shadow tree x x x x x x x x x X X
C). In a composed tree (root is a document) x x x x x
D). In a document deeply x x x x x x x x x x x x x x X
E). Disconnected (from D) x x

If you find any mistake on this summary or any other ideas, please let me know that.
I'd like to make a decision and add the definition of 'in a document deeply' (a better name is still wanted) in the spec.


comment: 37
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c37
Olli Pettay wrote on 2014-11-11 12:22:18 +0000.

(In reply to Hayato Ito from comment #36)

Thanks. If we agree that we should include shadow trees hosted by #c in 'D'
(aka 'in a document deeply), I am wondering what is the difference between:

  • the shadow tree hosted by #c
    and
  • the oldest shadow tree in the example.

Any node in either tree isn't used in rendering at all (aka they are not in
the composed tree (with document as root)), however,

  • Nodes in the shadow tree hosted by #c are 'in a document deeply',
  • Nodes in the oldest shadow trees, such as #f and #g, are not 'in a
    document deeply'.

That looks inconsistent to me.
Not to me.
In my mind only the youngest shadow tree is in the documented rooted composed tree if the host is in document rooted composed tree.
Older shadow trees are in document rooted composed tree only if they are attached to a shadow insertion point which is in
a document rooted composed tree.
I think this would be a quite simple way to spec this

I think 'nodes aren't contributing rendering' doesn't matter here because
it's like a node with display: none in a document.
true

Each node in shadow trees are 'in a document', conceptually.
Not quite, since the host might not be in a document.


comment: 38
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c38
Hayato Ito wrote on 2014-11-12 04:46:36 +0000.

(In reply to Olli Pettay from comment #37)

(In reply to Hayato Ito from comment #36)

Thanks. If we agree that we should include shadow trees hosted by #c in 'D'
(aka 'in a document deeply), I am wondering what is the difference between:

  • the shadow tree hosted by #c
    and
  • the oldest shadow tree in the example.

Any node in either tree isn't used in rendering at all (aka they are not in
the composed tree (with document as root)), however,

  • Nodes in the shadow tree hosted by #c are 'in a document deeply',
  • Nodes in the oldest shadow trees, such as #f and #g, are not 'in a
    document deeply'.

That looks inconsistent to me.
Not to me.
In my mind only the youngest shadow tree is in the documented rooted
composed tree if the host is in document rooted composed tree.
Older shadow trees are in document rooted composed tree only if they are
attached to a shadow insertion point which is in
a document rooted composed tree.

This is exactly what I thought when I saw your comment in #27.
After that, I've changed my mind because I found the inconsistency, as I explained in comment #36.
Could you have a closer look at comment #36? I'd like to understand why you don't think this is inconsistent.

It's not reasonable if we exclude only such an older shadow root, while including the shadow tree hosted by #c only for the reason that one is an older shadow tree and one is the youngest shadow tree.
Both shadow trees are in the same category in a sense that neither contribute to the document-rooted composed tree at all.

Basically, I think the distribution result shouldn't have any effect to 'in a document'-ness.
'In a document'-ness should be purely determined by the structure of the tree of trees.

In other words, adding/removing a element somewhere in the tree of trees shouldn't have any effect of 'in a document'-ness for other nodes in the tree of trees.

I guess there are two different kind of views for 'in a document'-ness in the shadow dom world.

A). Focusing a static structure of a tree of trees.
B). Focusing a dynamic structure. That's the document-rooted composed tree, which is the result of the distribution algorithm and the composition algorithm.

I think you have been focusing on B, but I'd like to focus on A here.
B will be likely to cause an inconsistency and make things complex. Unless we can find a serious issue in A, I'd like to go for A here.

Each node in shadow trees are 'in a document', conceptually.
Not quite, since the host might not be in a document.

Yeah, I shouldn't have omitted 'as long as the host is in a document deeply' here.


comment: 39
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c39
Boris Zbarsky wrote on 2014-11-12 10:05:10 +0000.

This comes down to questions like whether a non-distributed <iframe> should load its document, whether a non-distributed <style> should affect the styles of nodes, whether a non-distributed should load a stylesheet, whether a non-distibuted that was at one point distributed should continue running the plugin it loaded, whether a media element that stops being distributed should pause, whether non-distributed form controls should associate to forms, what should happen with showModal on a non-distributed , whether a <script> inserted under a non-distributed node should run, etc.

Note that it might turn out that the answers are different in those various different situation, in that some of them want non-distributed elements to act as if they were in a document and others don't...


comment: 40
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c40
Olli Pettay wrote on 2014-11-12 15:13:49 +0000.

(In reply to Hayato Ito from comment #38)

It's not reasonable if we exclude only such an older shadow root, while
including the shadow tree hosted by #c only for the reason that one is an
older shadow tree and one is the youngest shadow tree.
Why it is not reasonable?

Both shadow trees are in the same category in a sense that neither
contribute to the document-rooted composed tree at all.
Well, youngest tree does always contribute to the composed tree of rooted by its host.
Older, not distributed to any shadow insertion points are different.

Basically, I think the distribution result shouldn't have any effect to 'in
a document'-ness.
'In a document'-ness should be purely determined by the structure of the
tree of trees.

'in a document' -ness doesn't affect to the distribution.
Perhaps I should rephrase a bit. It is not only about the in-a-document, but about the composed tree rooted to a host
(and if that host is in document, that composed tree is in a composed tree which has document as root.).

A). Focusing a static structure of a tree of trees.
B). Focusing a dynamic structure. That's the document-rooted composed tree, which is the result of the distribution algorithm
and the composition algorithm.

I think you have been focusing on B, but I'd like to focus on A here.
B will be likely to cause an inconsistency and make things complex. Unless we can find a serious issue in A, I'd like to go for
A here.
Yeah, I'm thinking about B) and how event handling and such behave in the whole setup.

However, I think I could live with A too. I'm certainly not strongly against it :)
But let me think this a bit, like this evening.


comment: 41
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c41
Olli Pettay wrote on 2014-11-12 17:45:22 +0000.

So I think if one overrides existing shadow dom of an element without
providing shadow insertion point for the old shadow tree, I would expect the
elements in that older shadow tree to stop behaving as if they where
still in document. Say, you have an <iframe> there, and the younger
shadow tree just wants to override all that with something more lightweight
(and not provide ). I think the <iframe> should be unloaded as if it was
removed from document.
If one wants to keep the old stuff working, then just explicitly provide shadow insertion point.

And still, I could live with (A), but it feels a bit odd to keep the older
shadow working while one probably wants to override it all with something else.

c case is different. There you have an element #c which is in document already.

(so if #c is an iframe, it does load a new document). So if you know create a shadow root for #c and insert <iframe> to it, why wouldn't it load.


comment: 42
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c42
Olli Pettay wrote on 2014-11-12 18:21:42 +0000.

Though, there is then the issue that if
the old shadow dom has <iframe> and a new one is created, before the
new one has any content, the <iframe> from the older one would be unloaded.

To make that work properly there should be a way to create a shadow dom with one function call.
Something like
element.createShadowRoot("<iframe></iframe>I'm in shadow dom");
or
element.createShadowRoot(someOtherElementWhichWillBeAppendedToTheShadowRoot);


comment: 43
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c43
Hayato Ito wrote on 2014-11-13 07:27:32 +0000.

(In reply to Olli Pettay from comment #41)

So I think if one overrides existing shadow dom of an element without
providing shadow insertion point for the old shadow tree, I would expect the
elements in that older shadow tree to stop behaving as if they where
still in document. Say, you have an <iframe> there, and the younger
shadow tree just wants to override all that with something more lightweight
(and not provide ). I think the <iframe> should be unloaded as if it
was
removed from document.

Yeah, that's a good point and that's one of the potential issue in idea A.

I think the concern comes from the fact that there is no way to get rid of the existing old shadow trees completely from the shadow host in the current API set of Shadow DOM.
The reason we don't have such an API is that I've not heard the requirement for the removal, AFAIK.
I guess much attention has not been paid to such a wasteful resource, which would be consumed by overridden shadow trees, because that's a rare use case.

I'm okay to add such an API if this would be a non-ignorable use case and developers would start to complain about this kind of wastefulness.

(In reply to Boris Zbarsky from comment #39)

This comes down to questions like whether a non-distributed <iframe> should
load its document, whether a non-distributed <style> should affect the
styles of nodes, whether a non-distributed should
load a stylesheet, whether a non-distibuted that was at one point
distributed should continue running the plugin it loaded, whether a media
element that stops being distributed should pause, whether non-distributed
form controls should associate to forms, what should happen with showModal
on a non-distributed , whether a <script> inserted under a
non-distributed node should run, etc.

Note that it might turn out that the answers are different in those various
different situation, in that some of them want non-distributed elements to
act as if they were in a document and others don't...

Yeah, that's a good point. That should be always on my radar, however, it seems I forgot to mention that in my recent posts.

The basic idea in my head is:

  • We should treat such elements so that we got the equivalent result to "They were in a document (in a traditional meaning), but it is marked 'display: none'.

For example:

  • As for <script> element, we have to run the <script> 'in a document deeply, but not in the document-rooted composed tree', as long as <script> in a document runs even if it is marked with 'display: none'.
  • As for <iframe> element, we have to load the resources from <iframe> 'in a document deeply, but not in the document-rooted composed tree' as long as <iframe> 'in a document' loads resources even if this is marked with 'display: none'.

Of course, there should be a exception. For example, the current spec disables the capability of the and elements in shadow trees as if they were in a document fragment. The answers should be different in those various different situation as you mentioned.

I'd expect the my basic idea covers the most cases, hopefully.


comment: 44
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c44
Olli Pettay wrote on 2014-11-13 11:27:34 +0000.

(In reply to Hayato Ito from comment #43)

I'm okay to add such an API if this would be a non-ignorable use case and
developers would start to complain about this kind of wastefulness.

Yeah, ok, perhaps (A) for this case, and possibly add
createAndReplaceExistingShadowRoot() in the future.


comment: 45
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c45
Boris Zbarsky wrote on 2014-11-13 16:32:48 +0000.

  • We should treat such elements so that we got the equivalent result to "They
    were in a document (in a traditional meaning), but it is marked 'display: none'.

This is the part that's non-obvious to me, frankly. I mean, obviously if we treat them as being in a document they should be treated the same way as display:none. But the premise that they should be treated as in a document is not a given.

Of course, there should be a exception.

What's needed is a concrete list of those exceptions (in either direction). Starting with the list Chrome implements would be a good start, say, because then we at least have something to discuss.


comment: 46
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c46
Hayato Ito wrote on 2014-11-14 08:00:45 +0000.

Yeah, I think it's time to take a closer look at each case.

For example, in the HTML Living Standard, #in-a-document is referenced in:

2.1.3 DOM trees
3.1.3 DOM tree accessors
4.2.6 The style element
4.2.7 Interactions of styling and scripting
4.6.5.14 Link type "stylesheet" (2) (3) (4) (5)
4.8.5 The img element
4.8.7 The embed element (2)
4.8.8 The object element
4.8.14.8 Playing the media resource (2)
4.8.14.11.3 Assigning a media controller declaratively
4.10.18.3 Association of controls and forms (2)
4.10.19.8.3 User interface for bulk autofill
4.11.6.1 Facets
4.11.7 The dialog element
4.12.1 The script element (2) (3)
6.2 Inert subtrees
6.5.3 Processing model
7.1.1 Nested browsing contexts (2)
7.2.3 Accessing other browsing contexts (2)
15.3.1 The applet element
15.3.3 Frames

I've taken a quick look at each usage:

4.2.6 The style element

If element is not in a Document, then abort these steps.

4.2.7 Interactions of styling and scripting

... last time the event loop reached step 1, the element was in that Document, and the user agent hasn't given up on that particular style sheet yet.

4.6.5.14 Link type "styleseet"

When the external resource link is created on a link element that is already in a Document.

4.8.5 The img element

While a user agent is running the above algorithm for an element x, there must be a strong reference from the element's node document to the element x, even if that element is not in its Document.

4.8.6 The iframe element

For example if the user agent supports listing all the links in a document, links in "seamlessly" nested documents would be included in that list without being significantly distinguished from links in the document itself.

4.8.7 The embed element

... The element is in a Document or was in a Document the last time the event loop reached step 1.

4.8.8 The object element

... If the element has an ancestor media element, or has an ancestor object element that is not showing its fallback content, or if the element is not in a Document with a browsing context, o

4.8.14.8 Playing the media resource

.. Media elements that are potentially playing while not in a Document must not play any video, but should play any audio component.

4.8.14.11.3 Assigning a media controller declaratively

If there is another media element whose Document is the same as m's node document (even if one or both of these elements are not actually in the Document), and which also has a mediagroup attribute, and whose mediagroup attribute has the same value as the new value of m's mediagroup attribute, then let controller be that media element's current media controller.

4.10.18.3 Association of controls and forms

... If the element is reassociateable, has a form content attribute, and is itself in a Document, then run these substeps:

4.10.19.8.3 User interface for bulk autofill

... form is no longer in a Document

4.11.6.1 Facets

The element is in a Document that has an associated browsing context.

4.11.7 The dialog element

If subject is not in a Document, then throw an InvalidStateError exception and abort these steps.

4.12.1 The script element

The script element is in a Document and a node or document fragment is inserted into the script element, after any script elements inserted at that time.
The script element is in a Document and has a src attribute set where previously the element had no such attribute.

6.2 Inert subtrees

While a browsing context container is marked as inert, its nested browsing context's active document, and all nodes in that Document, must be marked as inert.

6.5.2 The accesskey attribute
6.5.3 Processing model

When the user presses the key combination corresponding to the assigned access key for an element, if the element defines a command, the command's Hidden State facet is false (visible), the command's Disabled State facet is also false (enabled), the element is in a Document

7.1.1 Nested browsing contexts

Certain elements (for example, iframe elements) can instantiate further browsing contexts. These are called nested browsing contexts. If a browsing context P has a Document D with an element E that nests another browsing context C inside it, then C is said to be nested through D, and E is said to be the browsing context container of C. If the browsing context container element E is in the Document D

7.2.3 Accessing other browsing contexts

The length IDL attribute on the Window interface must return the number of child browsing contexts that are nested through elements that are in the Document that is the active document of that Window object,

8.1.5.4 Events and the Window object

When an event is dispatched at a DOM node in a Document in a browsing context, if the event is not a load event, the user agent must act as if, for the purposes of event dispatching, the Window object is the parent of the Document object. [DOM]

15.3.1 The applet element

The element is not in a Document.

15.3.3 Frames

A frame element is said to be an active frame element when it is in a Document.

In addition to 'in a Document', I think we need to have better words in replace of 'inserted into a document' and 'removed from a document' in some places.

'inserted into a document' is referenced in:

4.2.5.3 Pragma directives (2)
4.2.6 The style element
4.6.5.14 Link type "stylesheet"
4.8.6 The iframe element
4.8.8 The object element
4.10.18.3 Association of controls and forms (2)
4.10.19.6.1 Autofocusing a form control: the autofocus attribute (2)
4.12.1 The script element (2)
7.6.3 Page load processing model for XML files (2)
8.1.4.1 Definitions
8.1.4.3 Generic task sources

'removed from a document' is referenced in:
4.2.6 The style element
4.8.6 The iframe element
4.8.8 The object element
4.8.14.8 Playing the media resource
4.8.14.19 Best practices for implementors of media elements
4.10.18.3 Association of controls and forms
4.11.7 The dialog element

Note that this is just a quick check. I have to do take another closer look in the next iteration.


comment: 47
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c47
Hayato Ito wrote on 2014-11-14 08:18:10 +0000.

Here is the filed chrome bugs:

I think the intentional exception in the current blink's implementation is and elements. See 7.1 Inert HTML Elements: http://w3c.github.io/webcomponents/spec/shadow/#inert-html-elements

I think the paragraph in the Shadow DOM spec:

7.1 Inert HTML Elements
All other HTML elements in the shadow trees must behave as if they were part of the document tree.

must be updated. Further more, we can remove this 7.1 section from the Shadow DOM spec if we finish all tasks here, hopefully.


comment: 48
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c48
Hayato Ito wrote on 2014-11-19 05:09:26 +0000.

*** Bug 25562 has been marked as a duplicate of this bug. ***


comment: 49
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c49
Hayato Ito wrote on 2014-11-19 07:47:31 +0000.

I've defined 'in a document deeply' (as a tentative name) in the Shadow DOM spec.
7b4bdc8

Now it's time to take a closer look at each case. I think <style> 1 is a good starter case for us.

Should we file a bug for HTML living standard 2 for each case and continue discussion there for each case?

If there is a need to discuss something in general further, we could use this thread anytime.

1 https://html.spec.whatwg.org/multipage/semantics.html#the-style-element
2 https://www.w3.org/Bugs/Public/buglist.cgi?bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&component=HTML&list_id=47544&product=WHATWG


comment: 50
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c50
Boris Zbarsky wrote on 2014-11-19 14:34:31 +0000.

Should we file a bug for HTML living standard 2 for each case

That seems like a good idea, yes.


comment: 51
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c51
Dimitri Glazkov wrote on 2014-11-19 15:46:46 +0000.

(In reply to Boris Zbarsky from comment #50)

Should we file a bug for HTML living standard 2 for each case

That seems like a good idea, yes.

Another thing that I ran by Hixie is just creating a patch against the HTML spec mirror (https://github.com/whatwg/html-mirror) -- if that's more lightweight.


comment: 52
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c52
Hayato Ito wrote on 2014-11-20 07:22:10 +0000.

(In reply to Dimitri Glazkov from comment #51)

(In reply to Boris Zbarsky from comment #50)

Should we file a bug for HTML living standard 2 for each case

That seems like a good idea, yes.

Another thing that I ran by Hixie is just creating a patch against the HTML
spec mirror (https://github.com/whatwg/html-mirror) -- if that's more
lightweight.

Thanks. I like it. It's a convenient way for me to create a patch, on which we could discuss.


comment: 53
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365#c53
Ian 'Hixie' Hickson wrote on 2014-11-21 23:25:51 +0000.

Thanks for the list above, Hayato.

When considering these, one should also consider:

  • a node A that's a child of an element that has a shadow tree that doesn't have an insertion point for A.
  • a node A that's a grandchild of an element that has a shadow tree that doesn't have an insertion point for A.
  • a node that's in a shadow tree of an element B that itself is a child of an element with a shadow tree that doesn't have an insertion point for B.
  • a node that is display:none.
  • an orphan node.
  • a node in a shadow tree of an orphan node.
  • a node that is being rendered
  • a node that is not being rendered but that is in the composed tree

In general, I think we want to have as few categories of elements here as possible. In particular, I think "being rendered vs not being rendered", "in the document deeply vs not", "in the document directly vs not", and "scoped to the current subtree" are reasonable categories.

So it seems to me that for the above we should go as follows:

"In the document":

(e.g. you don't want rel=import working from inside a shadow tree)

"Being rendered":


focusable

"Scoped to the current subtree":
media controllers
form control associations

"In the document deeply":

<script> exposure accesskey autofocus <iframe>, window.length inertness of browsing context container <style>

[Shadow]: Shadow trees should somehow contain base URL information (bugzilla: 22255)

Title: [Shadow]: Shadow trees should somehow contain base URL information (bugzilla: 22255)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22255


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22255#c0
Dimitri Glazkov wrote on 2013-06-03 23:06:43 +0000.

See this thread for context: http://lists.w3.org/Archives/Public/public-webapps/2013AprJun/thread.html#msg782

I like Jonas' internal state idea.

[Shadow]: rename <content> to <slot> (bugzilla: 28561)

Title: [Shadow]: rename to (bugzilla: 28561)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28561


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28561#c0
Anne wrote on 2015-04-27 05:30:45 +0000.

Since we successfully managed to avoid bikeshedding at the meeting... I think makes more sense, especially with an API. "Distributing nodes into slots".


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28561#c1
Justin Fagnani wrote on 2015-04-27 07:04:07 +0000.

I'm honestly not sure that makes more sense than . It's not just any nodes that can be redistributed - it must be children of the host, so makes sense here to me. is where all or some of the hosts content goes.


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28561#c2
Travis Leithead [MSFT] wrote on 2015-04-27 20:00:34 +0000.

Slot does seem pretty generic... like . Can't say I'm behind the new name idea either.


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28561#c3
Hayato Ito wrote on 2015-04-30 10:42:34 +0000.

This might be bikeshed. :)

Can we defer the decision until the upcoming Imperative APIs proposal?
I hope the situation will be more clear after that.


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28561#c4
Anne wrote on 2015-04-30 11:31:03 +0000.

Sure, I don't feel strongly about this. Dimitri came up with this and I liked it since it was a somewhat shorter and clearer name.

To reply to Justin, it's the host element's content that is distributed. But it's not distributed into content... Rather, it's content distributed into slots based on (most likely) a Turing complete set of rules.


comment: 5
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28561#c5
Hayato Ito wrote on 2015-04-30 12:47:59 +0000.

If I were allowed to write the spec from the scratch, I prefer "slot" to "content" because the name of "slot" is more intuitive than insertion points to me.

However, I am not sure this kind of renaming is really worth doing only because we find a better name.

I'd like to defer this, given we have more high priority tasks.


comment: 6
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28561#c6
Anne wrote on 2015-04-30 12:53:15 +0000.

Okay, let's wait for the imperative API. Because if we change that, we can change this too.

[Shadow]: Shadow host with tabindex=-1, all descendent tree should be ignored for tab navigation (bugzilla: 27965)

Title: [Shadow]: Shadow host with tabindex=-1, all descendent tree should be ignored for tab navigation (bugzilla: 27965)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27965


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27965#c0
Takayoshi Kochi wrote on 2015-02-05 07:51:29 +0000.

In the current Shadow DOM spec, basically focusable nodes in a shadow tree are inserted after their shadow host in the tab navigation order.

This means that when shadow host has "tabindex=-1", the host itself is skipped in the order, but right after the host the descendant nodes in its shadow tree will be visited.

This is probably not the behavior that a component author or user would expect.


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27965#c1
Charles McCathieNevile wrote on 2015-02-19 06:00:33 +0000.

I'm not immediately clear why this would be unexpected...

A couple of scenarios:

  • A date picker should have a tabindex at its root, so this doesn't arise.
  • A sound mixer may well begin with a bunch of non-interactive material, and be the main component on a page. So it seem logical that it doesn't have a tabindex at the root (although it might well be a landmark, in screen reader navigation terms).

Am I missing something obvious? (That seems quite possible)


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27965#c2
Takayoshi Kochi wrote on 2015-02-26 06:10:12 +0000.

Let me explain an example.

Suppose I have an component (which is out of control of mine)
2 focusables contained in a shadow.

|#shadow-root | save cookie | Help

I put it in some form:

Name: Password:

And want to skip for typical cases, only require
name and password then user can hit login button.
So I put tabindex=-1 in

Name: Password:

Actually, this doesn't skip the checkbox and help link.
Demo: http://jsfiddle.net/4y3xntx8/


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27965#c3
Charles McCathieNevile wrote on 2015-02-26 10:43:04 +0000.

Thanks for the example.

I think the general idea makes sense - changing the shadow root's tabindex should apply to whatever is in the component.

There is an analagous situation in aria. I'll have a look what they say, but I suspect their answer will be "build JS that manages this", which doesn't really help in this case…

(There is a problem with the example: the functionality inaccessible for keyboard. The normal interaction pattern would be to fill in the things you want, then hit enter to submit the form.)

[Shadow]: Event model (bugzilla: 28564)

Title: [Shadow]: Event model (bugzilla: 28564)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28564


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28564#c0
Anne wrote on 2015-04-27 08:26:48 +0000.

This is a bug to figure out the overall changes needed to the DOM event dispatch algorithm for shadow DOM.


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28564#c1
Anne wrote on 2015-04-27 08:58:43 +0000.

So we need to modify event dispatch as follows:

  • Add a flag to restrict dispatch to the current tree (needed e.g. for 's load and error events)
  • Calculate relatedTarget (might affect composed path)
  • Calculate the composed path based on relatedTarget, the aforementioned flag, ...

Then listener invocation needs these changes:

  • Modify target, currentTarget, relatedTarget, offsetX/Y, Touch#target to be relative
  • Modify deepPath to exclude hidden/isolated trees

And we should consider exposing these members:

  • path (excludes all shadow trees)
  • deepTarget (deepPath[0])
  • deepRelatedTarget (not available right now)
  • deepOffsetX/Y (not available right now)
  • Touch#deepTarget (not available right now)

(It seems a little bit unfortunate that we need to special case certain UI events in the generic event dispatch algorithm. Perhaps we can find a way for the UI Events specification to tackle the relatedTarget needs and such.)


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28564#c2
Anne wrote on 2015-04-27 13:16:31 +0000.

Note that if we add a flag for event dispatch we should also add that flag to dispatchEvent():

obj.dispatchEvent(ev, { scope: "subtree" })


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28564#c3
Olli Pettay wrote on 2015-04-27 16:34:44 +0000.

We don't need to do everything at once, like that
obj.dispatchEvent(ev, { scope: "subtree" }) can be added if someone actually
needs it.
The current Shadow DOM and XBL have lived just fine without it.

We don't want shorthand for deepPath[0], I think. So not that kind of deepTarget.
And for relatedTarget there could be also a list, not deepRelatedTarget.


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28564#c4
Anne wrote on 2015-04-27 16:45:48 +0000.

(In reply to Olli Pettay from comment #3)

The current Shadow DOM and XBL have lived just fine without it.

Not really, see bug 20247 for which it is meant. I guess we don't need to expose the API to JavaScript directly, but we do need the feature.


comment: 5
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28564#c5
Olli Pettay wrote on 2015-04-27 16:51:16 +0000.

Sure, Events need that flag, but it doesn't need to be exposed in any way to scripts, unless needed.
(Though, I'm not really against that, but just hoping that we don't add such features to the platform that no one will use.)

[Shadow]: Fully explore composition (bugzilla: 27401)

Title: [Shadow]: Fully explore composition (bugzilla: 27401)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27401


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27401#c0
Dimitri Glazkov wrote on 2014-11-21 18:46:54 +0000.

This is a meta bug for polishing Shadow DOM as a composition primitive.
https://gist.github.com/dglazkov/716913d889c38e42d55c

With Shadow DOM, the developers finally have the composition boundaries to help them reason about larger web apps in terms of smaller chunks. The actual concept is not unique. What's unique about it is that the Web Platform is also aware of these boundaries.

We have a whole set of challenges ahead of us. We need to make sure that the composition boundaries have the right crunchy/gooey balance to be truly useful, we need to build introspection tooling to make these composition boundaries more grokkable. We also need to ensure that these boundaries are designed in a way that allows the browser to help developer build modern UX (http://bit.ly/blink-midnight-train as an example of UX guidelines).

Some of these challenges are conflicting with each other, and the problem easily gets into the over-constrained territory.

We also need better terminology. "Information hiding" sounds negative and purposeless. Why would anyone want to hide information?

"Encapsulation" is a super-overloaded term. When you say it to one crowd, they hear iframe. To another crowd, it sounds like something different.

I suggest we use the term "composition" and see how far we can get.

For example, the question "when should I put things in Shadow DOM?" is a symptom of approaching the problem from the wrong angle. It's effectively the same question as "when should I put things in a class?"

I, as a developer, should use Shadow DOM when I need to draw composition boundaries in my code. The consistency of these composition boundaries should be flexible enough to express the degrees of composition I need in each particular case.

For example, when I build a element, it seems nonsensical for document.activeElement to return when I focused something inside of it. However, it's equally non-sensical for element to not do that.

Unfortunately, too often, "flexibility" is another word for "added complexity" and "unpredictable performance characteristics". This is the hardest constraint. We should avoid adding more bloat to the platform.


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27401#c1
Olli Pettay wrote on 2014-11-21 21:12:40 +0000.

(In reply to Dimitri Glazkov from comment #0)

We also need better terminology. "Information hiding" sounds negative and
purposeless. Why would anyone want to hide information?
negative? To me information hiding sounds like a positive thing.
You expose only what you need to and the outside world should be ok with that.
It is up to you to expose what you want, and if you aren't exposing enough, the outside world can't really
co-operate with or approve you.

"Encapsulation" is a super-overloaded term. When you say it to one crowd,
they hear iframe. To another crowd, it sounds like something different.
Indeed

I suggest we use the term "composition" and see how far we can get.
Composition doesn't really say much. Composition of what, or which objects or well, what?

For example, the question "when should I put things in Shadow DOM?" is a
symptom of approaching the problem from the wrong angle.
Why?

It's effectively
the same question as "when should I put things in a class?"
Object oriented languages are pretty popular, and there classes have proved to be
rather useful abstractions. (Even JS is getting classes)

I, as a developer, should use Shadow DOM when I need to draw composition
boundaries in my code.
One question is that why to use shadow DOM when you can achieve the same approach by just
using DOM/CSS classes. If you consistently annotate your elements with the right class, and deal with
with those explicitly or deal with all the elements regardless of class attributes, you end up to
quite similar (not the same) setup to non-information-hiding-nor-encapsulating-shadow-dom.

For example, when I build a element, it seems nonsensical for
document.activeElement to return when I focused something inside of
it.
Er, what? I'd definitely expect document.activeElement to return my-app since that is what the outside
world should see.
If you don't want any encapsulation or information hiding, just don't use shadow DOM.

Unfortunately, too often, "flexibility" is another word for "added
complexity" and "unpredictable performance characteristics". This is the
hardest constraint. We should avoid adding more bloat to the platform.
Yeah, I've been thinking this lately. By default shadow dom makes many things slower.
Perhaps not much, but still does. (More complicated event propagation, more complicated element bind-to-tree/unbind-from-tree, etc).

The following is just something I've been thinking and shouldn't be taken too seriously:
Since the current form of web components doesn't really provide what I'd call information hiding or encapsulation, and
perhaps those aren't even goals in its current incarnation, maybe it would be simpler to just not have shadow DOM
for the cases where those aren't needed.
If one could say "this particular subtree is my component", that might help already.
Perhaps it would mean replacing/renaming elements with similarly behaving elements or annotating elements in some other way.
Insertion points would be there just in the initial step to put the elements from the outside world to the right places
in the DOM tree.

normal dom.

document.getElementById(d).installComponent("myComponent");

->

normal dom.

comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27401#c2
Dimitri Glazkov wrote on 2014-11-21 23:38:31 +0000.

(In reply to Olli Pettay from comment #1)

(In reply to Dimitri Glazkov from comment #0)

We also need better terminology. "Information hiding" sounds negative and
purposeless. Why would anyone want to hide information?
negative? To me information hiding sounds like a positive thing.
You expose only what you need to and the outside world should be ok with
that.
It is up to you to expose what you want, and if you aren't exposing enough,
the outside world can't really
co-operate with or approve you.

"Encapsulation" is a super-overloaded term. When you say it to one crowd,
they hear iframe. To another crowd, it sounds like something different.
Indeed

I suggest we use the term "composition" and see how far we can get.
Composition doesn't really say much. Composition of what, or which objects
or well, what?

For example, the question "when should I put things in Shadow DOM?" is a
symptom of approaching the problem from the wrong angle.
Why?

See the rest of that sentence, it meant to all work together :)

It's effectively
the same question as "when should I put things in a class?"
Object oriented languages are pretty popular, and there classes have proved
to be
rather useful abstractions. (Even JS is getting classes)

Exactly my point. The question of when I should put things in a class is along the same lines -- you do it when it's useful for your software engineering needs.

I, as a developer, should use Shadow DOM when I need to draw composition
boundaries in my code.
One question is that why to use shadow DOM when you can achieve the same
approach by just
using DOM/CSS classes. If you consistently annotate your elements with the
right class, and deal with
with those explicitly or deal with all the elements regardless of class
attributes, you end up to
quite similar (not the same) setup to
non-information-hiding-nor-encapsulating-shadow-dom.

Shadow DOM is not a capability. It's a productivity tool. At the limit, you can achieve the same things with a stick and a rock that you can achieve with a power tool. The difference is in the level of patience, discipline, and effort it takes.

For example, when I build a element, it seems nonsensical for
document.activeElement to return when I focused something inside of
it.
Er, what? I'd definitely expect document.activeElement to return my-app
since that is what the outside
world should see.
If you don't want any encapsulation or information hiding, just don't use
shadow DOM.

As I mentioned, Shadow DOM is about composition. Encapsulation and information hiding are just facets of composition. There are more.

Unfortunately, too often, "flexibility" is another word for "added
complexity" and "unpredictable performance characteristics". This is the
hardest constraint. We should avoid adding more bloat to the platform.
Yeah, I've been thinking this lately. By default shadow dom makes many
things slower.
Perhaps not much, but still does. (More complicated event propagation, more
complicated element bind-to-tree/unbind-from-tree, etc).

In some cases yes, but in some cases it's actually a win. Style resolution is easier because of inherent scoping.

I would also be interested in figure out ways in which we could turn off or simplify event retargeting for developers who aren't interested in it, or similar performance-optimizations for distributions, etc.

I am realizing now that I severely over-constrained the problem space by trying to solve both "explain HTML form elements" and "enable composition" with the same primitive. It seemed like a great idea at the time, because the former problem helped the latter stay more opinionated about the HTML/DOM ways and not get too crazy.

The following is just something I've been thinking and shouldn't be taken
too seriously:
Since the current form of web components doesn't really provide what I'd
call information hiding or encapsulation, and
perhaps those aren't even goals in its current incarnation, maybe it would
be simpler to just not have shadow DOM
for the cases where those aren't needed.
If one could say "this particular subtree is my component", that might help
already.
Perhaps it would mean replacing/renaming elements with similarly behaving
elements or annotating elements in some other way.
Insertion points would be there just in the initial step to put the elements
from the outside world to the right places
in the DOM tree.

normal dom.

document.getElementById(d).installComponent("myComponent");

->

normal dom.

Yes! This is effectively what Shadow DOM and custom elements do today. The custom elements are the insertion points. That's why we built this whole Web Components thing. But don't listen to me, listen to this guy: https://www.youtube.com/watch?v=6vcQlD-jadk. He's not great, but tries to explain the overall approach bottom-up.


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27401#c3
Olli Pettay wrote on 2014-11-23 17:15:01 +0000.

(In reply to Dimitri Glazkov (afk until Dec 1, 2014) from comment #2)

For example, the question "when should I put things in Shadow DOM?" is a
symptom of approaching the problem from the wrong angle.
Why?

See the rest of that sentence, it meant to all work together :)
It still doesn't say why
'the question "when should I put things in Shadow DOM?" is a
symptom of approaching the problem from the wrong angle'

Exactly my point. The question of when I should put things in a class is
along the same lines -- you do it when it's useful for your software
engineering needs.
Hmm, somehow I'm misreading you here, I think. Since yes, this is all about
usefulness. But the question is what are the use cases. The level of information hiding and encapsulation
affect quite a bit to the possible use cases.

I am realizing now that I severely over-constrained the problem space by
trying to solve both "explain HTML form elements" and "enable composition"
with the same primitive.
That indeed may have lead to some confusion. It has not been too clear always what
Shadow DOM is aimed for.

Yes! This is effectively what Shadow DOM and custom elements do today. The
custom elements are the insertion points.
But why the need for shadow DOM then? Why the need for making the platform much more complicated when
something simpler might have been enough. (if we didn't have shadow DOM, we wouldn't have to modify event dispatch, nor go through
all the spec and their use of is-in-document etc.)


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27401#c4
Dimitri Glazkov wrote on 2014-11-23 19:00:47 +0000.

(In reply to Olli Pettay from comment #3)

(In reply to Dimitri Glazkov (afk until Dec 1, 2014) from comment #2)

For example, the question "when should I put things in Shadow DOM?" is a
symptom of approaching the problem from the wrong angle.
Why?

See the rest of that sentence, it meant to all work together :)
It still doesn't say why
'the question "when should I put things in Shadow DOM?" is a
symptom of approaching the problem from the wrong angle'

Let me try this way: the answer to this question is not specific to Shadow DOM, it's a general OOP question. Thus, the angle of looking at it as feature-specific practices is wrong.

Yes! This is effectively what Shadow DOM and custom elements do today. The
custom elements are the insertion points.
But why the need for shadow DOM then? Why the need for making the platform
much more complicated when
something simpler might have been enough. (if we didn't have shadow DOM, we
wouldn't have to modify event dispatch, nor go through
all the spec and their use of is-in-document etc.)

I disagree. Having gone over this exercise many times in the last few years, I am convinced that we have the right solution shape. We do need to make sure we give developers the ability to opt in/out with some features. That's what this bug is about.


comment: 5
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27401#c5
Travis Leithead [MSFT] wrote on 2015-02-24 02:00:26 +0000.

I love this meta-bug :)

When you use the word "composition", I think of making a big pot of chili--all the ingredients are throw into the pot and mixed together to form a whole. In web components, the hosting page is the pot, and the elements it contains have been "composed" into it. In my mind, isolation in a composed environment is what gives you a component. So, prior to the days of "web components" we already had at least one component: the <iframe> (and window.open, framesets, object tag, etc., etc.).

So what makes web components different? What makes them a better solution than <iframe> (which is an incredibly popular component model today :-)?

From what I understand, its that iframe's isolation is too strict for certain composition scenarios. Iframe isolates along all three vectors of the web--isolated script environment, isolated CSS environment, and isolated document and URL. Of course, we've slowly refined this model over time: document.domain opt-ins, postMessage passing, sandbox, and seamless attributes, etc. Yet, it's still not what folks are looking for in a web component model.

So, we took web components to the opposite side of the spectrum--we built a web components model that did an absolutely minimal job of isolation. No script environment isolation, no CSS isolation, an open bridge to the shadow content.

As pointed out above, what we have is very complicated and could be accomplished through much simpler means. I propose the question: was turning from strong isolation to the current model a swing too far in the opposite direction?

iframes force component authors to work closely together with the content that hosts them: the content within the iframe cooperating with iframe's host environment. This is a well-oiled machine thanks to the enforcements of the same-origin security model. This forces good encapsulation, good contracts, etc. The disadvantages already noted still apply though--it's not an integrated/composed solution.

Yet, we loose something significant with the way shadow dom is built today--there is no more cooperation! In fact, the component's sense of identity is completely lost. The hosting page has full control, full access and full veto power. If you look at it from the host's POV, this seems fine (they get full integration rights). But from the POV of the component author, there are difficult challenges with today's model--and I think we see them in the concerns regarding "open or closed" scripting, defining parts/states or >>> for CSS.

Basically, I think that went too far away from isolation. We built the right primitives for a host to assemble a component model, but we dropped the isolation scenarios that are still important in scripting and CSS for components that might not want to cede full access to the host.

Where am I going with this? I think we need to take a very careful look at the script and CSS isolation models and what might be done to improve the state-of-the-art in that respect. Depending on the outcome, it could lead to a much simpler shadow dom model--which I think is still the right primitive at its core.


comment: 6
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27401#c6
Dimitri Glazkov wrote on 2015-02-24 02:11:27 +0000.

(In reply to Travis Leithead [MSFT] from comment #5)

Thanks for the insightful comment.

Where am I going with this? I think we need to take a very careful look at
the script and CSS isolation models and what might be done to improve the
state-of-the-art in that respect. Depending on the outcome, it could lead to
a much simpler shadow dom model--which I think is still the right primitive
at its core.

Could you look over https://github.com/w3c/webcomponents/wiki/Shadow-DOM:-Contentious-Bits and see if there are any bits that are missing or any pros/cons that are not mentioned? Appreciate any help in improving the wiki doc ahead of the F2F.

Shared mixin for Document and ShadowRoot

Title: [Shadow]: Have a common interface between Document and ShadowRoot (bugzilla: 28493)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28493


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28493#c0
Hayato Ito wrote on 2015-04-15 06:37:12 +0000.

This is separated from https://www.w3.org/Bugs/Public/show_bug.cgi?id=27829#c2

Instead of defining these in Shadow Root as well as in Document, I've started to feel that it'd be better that we have the common interface between Document and Shadow Root.

e.g.

    interface NodeTreeRoot {
      Element? elementFromPoint(double x, double y);
      sequence<Element> elementsFromPoint(double x, double y);
      CaretPosition? caretPositionFromPoint(double x, double y);
      Selection? getSelection ();
      readonly    attribute Element?       activeElement;
      readonly    attribute StyleSheetList styleSheets;
    };


    Document implements NodeTreeRoot;
    ShadowRoot implements NodeTreeRoot;

comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28493#c1
Anne wrote on 2015-04-15 08:22:32 +0000.

Perhaps something along the lines of LayoutRoot?


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28493#c2
Hayato Ito wrote on 2015-04-15 09:27:47 +0000.

Thank you.

BTW, in Blink, we use a term of TreeScope for this purpose, at least in C++.
Both Document and ShadowRoot implements TreeScope.

(In reply to Anne from comment #1)

Perhaps something along the lines of LayoutRoot?

So the candidates are:

  • NodeTreeRoot
  • LayoutRoot
  • TreeScope

Any other better idea?


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28493#c3
Anne wrote on 2015-04-15 09:32:58 +0000.

TreeScope and NodeTreeRoot both have the problem that their terminology also applies to Element and DocumentFragment.

What's special about ShadowRoot and Document is that they are layout/CSS/stylesheet boundaries.


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28493#c4
Hayato Ito wrote on 2015-04-15 11:29:25 +0000.

Thank you for the explanation. I understand. Only Document and ShadowRoot contribute to Layout Tree. That's true!

+1 for LayoutRoot.


comment: 5
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28493#c5
Tab Atkins Jr. wrote on 2015-04-15 16:44:38 +0000.

I used the name "TreeScope" in http://tabatkins.github.io/specs/construct-stylesheets/#adding-stylesheets.

But Anne's comments make some sense. I'm fine with LayoutRoot.

inflexible extends as fixed element type

I'd like to be able to specify any type (or perhaps certain types) of tags, with is= to augment functionality of any element. The initialization sequence I'm imagining is passed the native element instance, and then the component would be able to add its own capabilities to that instance's prototype chain (could also choose to prepare the prototype chain so that element.prototype is already distinguished from that element's native prototype, as a helpful refinement to developers).

A similar technique could be used to add multiple mixins to a tag, assuming they'd been designed them to be complementary/concerned with orthogonal aspects of the markup/content. I think of that as with= rather than is=.

Shadow DOM, <style>, and document.styleSheets

Title: [Shadow]: Style element should specify when to create and add style sheet in shadow DOM (bugzilla: 26850)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26850


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26850#c0
William Chen wrote on 2014-09-18 18:32:10 +0000.

The spec currently specifies the ShadowRoot styleSheets property as:

"On getting, the attribute must return a StyleSheetList sequence containing the shadow root style sheets."

The spec for the style element only specifies creating sheets for elements "in a Document":

https://html.spec.whatwg.org/multipage/semantics.html#update-a-style-block

The spec for "create a CSS style sheet" only adds sheets to the document:

http://dev.w3.org/csswg/cssom/#create-a-css-style-sheet

As it's currently specified, .styleSheets always returns an empty list.


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26850#c1
Simon Pieters wrote on 2014-09-19 11:15:21 +0000.

HTML and/or CSSOM can probably be changed if needed.


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26850#c2
Ian 'Hixie' Hickson wrote on 2014-09-26 18:27:21 +0000.

Yeah. Tell us what needs changing.


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26850#c3
Kenji Baheux wrote on 2014-12-04 07:45:01 +0000.

Hayato: let me increase the priority since we probably need to resolve this one to move forward on 27418


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26850#c4
Hayato Ito wrote on 2014-12-04 07:50:42 +0000.

I think this is yet another instance of 'In a Document' issue.
See https://www.w3.org/Bugs/Public/show_bug.cgi?id=26365.

[Shadow]: Multiple trees are introduced to explain encapsulation. (bugzilla: 23481)

Title: [Shadow]: Multiple trees are introduced to explain encapsulation. (bugzilla: 23481)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23481


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23481#c0
johnjbarton wrote on 2013-10-10 16:09:11 +0000.

" Encapsulation is effectively a natural property of having multiple trees."

I pondered the first part of this document for a long while: "tree of trees" makes no sense. Graphically, a tree of trees is just a tree. Look at all the diagrams in the first part of the doc: just trees with solid or dotted lines and some superfluous-looking boxes.

Eventually it came to me: 'tree of trees' was invented to explain that parts of the tree are encapsulated from other parts. Eventually this was confirmed in the quote above.

The story would be much clearer if you say that right when you introduce the neology 'tree of trees'. Rather than starting with complicated definitions, just say that the Shadow DOM spec defines new encapsulated DOM sub-trees. When we introduce this encapsulated sub-tree into the existing DOM tree, we call the result a 'tree of trees' to emphasis the encapsulation while also showing that tree navigation operation existed between pre-shadow-DOM nodes and Shadow DOM nodes.


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23481#c1
Yuta Kitamura wrote on 2013-10-22 07:00:51 +0000.

Yeah, I agree that inter-tree interactions are not very obvious. I think
it's the specification's job to explain the "naturalness" in written form.

[Shadow]: Consider a <content> selector for "nodes not otherwise distributed" (bugzilla: 22268)

Title: [Shadow]: Consider a selector for "nodes not otherwise distributed" (bugzilla: 22268)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22268


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22268#c0
Jan Miksovsky wrote on 2013-06-04 20:33:21 +0000.

See the thread at https://groups.google.com/forum/#!topic/polymer-dev/mTM1-rByfZY for a limitation of the current spec.

The current design of means the default insertion point for all nodes not otherwise distributed (via select="...") must always appear last in the template. This could lead to situations where it is difficult to update a template and reposition this default insertion point before other insertion points that have explicit select="..." clauses.

It would be beneficial if there were a way to explicit indicate that element should pick up all nodes not otherwise distribution to other insertion points. Alternatively, the meaning of the plain form could be changed to: "insert here all nodes not otherwise distributed, including nodes distributed to insertion points which follow this default insertion point".


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22268#c1
Dominic Cooney wrote on 2013-06-05 06:50:43 +0000.

You may be able to work around this problem by using CSS Regions.

Two slightly more powerful mechanisms than the proposal to make happen "last" are:

  1. Distribute to elements not in document order, but in selector specificity order. Make with no selector less specific than any selector. Document order of element is a fallback for tiebreaking.
  2. Let the author separately specify an order to do distribution.

comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22268#c2
Jan Miksovsky wrote on 2013-06-06 00:42:16 +0000.

I think you understand the use case, and defer to your judgment on the best solution. My proposal was just an example.

For reference: I did try using CSS regions to workaround this problem, but am unable to get this to work. See http://jsbin.com/areqez/1/edit. I'll follow up separately on that.


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22268#c3
Michael Labriola wrote on 2013-10-14 19:21:00 +0000.

Personally I like @Dominic-(migrated-from-bugzilla-to-avoid-pinnging-users-in-github)'s first proposal. I think the root of the problem is that node distribution is in document order instead of the order of a form of specificity.


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22268#c4
Steve Orvell wrote on 2013-11-07 15:28:28 +0000.

I prefer Dominic's suggestion #2. The author could specify selectIndex attribute on insertion points which would conceptually act like tabIndex.

I think the problem with #1 is that the set of selectors used for insertion points is already highly limited. I think, in practice, this would make using specificity problematic.


comment: 5
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22268#c5
Anne wrote on 2015-04-27 05:45:15 +0000.

This might be moot if we get an API.

Support `>>>` combinator in static profile

Title: [Shadow]: Figure out a good replacement for /deep/ in testing scenarios (bugzilla: 28591)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28591


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28591#c0
Dimitri Glazkov wrote on 2015-05-01 17:22:53 +0000.

One thing that immediately popped up once we started talking about removing shadow-piercing combinators is that WebDriver-based tests are frequently interested in reaching into shadow trees to grab a specific element to test:

https://code.google.com/p/chromium/codesearch#chromium/src/chrome/test/chromedriver/test/run_py_tests.py&sq=package:chromium&q=testShadowDom*&l=877

Web Driver actually has something currently that attempts to solve the problem: http://www.w3.org/TR/webdriver/#switching-to-hosted-shadow-doms

However, the feedback I got from ChromeDriver folks is that it's way too verbose and awkward to use for the most common case (see above).

Maybe the solution is just specifying deepQuerySelector for WebDriver spec. However, I want to make sure this is not just a one-off -- seems like this could be needed in other contexts.


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28591#c1
Anne wrote on 2015-05-02 07:34:03 +0000.

  1. We shouldn't do features for testing. That's bad.

  2. I remain convinced that in the open case we should provide a myriad of features that cross the "deep" to aid with selection, event delegation, composition, etc.


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28591#c2
Elliott Sprehn wrote on 2015-05-03 00:41:03 +0000.

(In reply to Anne from comment #1)

  1. We shouldn't do features for testing. That's bad.

  2. I remain convinced that in the open case we should provide a myriad of
    features that cross the "deep" to aid with selection, event delegation,
    composition, etc.

+1, we should keep /deep/ in the static profile for querySelector. Before we had it authors kept rolling their own (we saw this on multiple occasions).


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28591#c3
Anne wrote on 2015-05-04 06:12:37 +0000.

Note that an alternative is that we introduce .deepQuery() or some such.


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28591#c4
Elliott Sprehn wrote on 2015-05-04 06:21:02 +0000.

(In reply to Anne from comment #3)

Note that an alternative is that we introduce .deepQuery() or some such.

deepQuery is not enough, you don't want to match a descendant selector across a ShadowRoot boundary since ".a .b" means something really different. You'd still need a special combinator to signal where the scope crossing should be in the selector expression.

ex.
.panel .image

All images inside panels contained in a single scope.

.panel /deep/ .image

All images anywhere below a panel, even if they're inside a nested widget.

This is important because it maintains the "don't accidentally cross a boundary" principle.

We need something like ::shadow as well.


comment: 5
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28591#c5
Tab Atkins Jr. wrote on 2015-05-05 00:12:16 +0000.

(In reply to Elliott Sprehn from comment #4)

(In reply to Anne from comment #3)

Note that an alternative is that we introduce .deepQuery() or some such.

deepQuery is not enough, you don't want to match a descendant selector
across a ShadowRoot boundary since ".a .b" means something really different.
You'd still need a special combinator to signal where the scope crossing
should be in the selector expression.

ex.
.panel .image

All images inside panels contained in a single scope.

.panel /deep/ .image

All images anywhere below a panel, even if they're inside a nested widget.

This is important because it maintains the "don't accidentally cross a
boundary" principle.

Yeah, trying to move the shadow-crossing quality to the core of the method doesn't work. It's much less flexible, as you note, and doesn't compose with anything else similar. The correct approach is to just embrace the "static profile" of selectors http://dev.w3.org/csswg/selectors/#static-profile and leave /deep/ there. (Or >>>, as it's now called.)


comment: 6
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28591#c6
Hayato Ito wrote on 2015-05-07 08:43:56 +0000.

(In reply to Tab Atkins Jr. from comment #5)

(In reply to Elliott Sprehn from comment #4)

(In reply to Anne from comment #3)

Note that an alternative is that we introduce .deepQuery() or some such.

deepQuery is not enough, you don't want to match a descendant selector
across a ShadowRoot boundary since ".a .b" means something really different.
You'd still need a special combinator to signal where the scope crossing
should be in the selector expression.

ex.
.panel .image

All images inside panels contained in a single scope.

.panel /deep/ .image

All images anywhere below a panel, even if they're inside a nested widget.

This is important because it maintains the "don't accidentally cross a
boundary" principle.

Yeah, trying to move the shadow-crossing quality to the core of the method
doesn't work. It's much less flexible, as you note, and doesn't compose
with anything else similar. The correct approach is to just embrace the
"static profile" of selectors
http://dev.w3.org/csswg/selectors/#static-profile and leave /deep/ there.
(Or >>>, as it's now called.)

Is there any existing clients who use static-profile?
Does it mean '/deep/' can be used in particular APIs?


comment: 7
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28591#c7
Tab Atkins Jr. wrote on 2015-05-07 15:55:04 +0000.

(In reply to Hayato Ito from comment #6)

Is there any existing clients who use static-profile?
Does it mean '/deep/' can be used in particular APIs?

It's for querySelector()/etc.


comment: 8
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28591#c8
Hayato Ito wrote on 2015-05-08 02:25:11 +0000.

(In reply to Tab Atkins Jr. from comment #7)

(In reply to Hayato Ito from comment #6)

Is there any existing clients who use static-profile?
Does it mean '/deep/' can be used in particular APIs?

It's for querySelector()/etc.

Thanks.

Can everyone agree that '/deep/' is okay to be used in querySelector()?

I think we are assuming that adding something to static profile is zero-overhead to the performance of dynamic profile.


comment: 9
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28591#c9
Tab Atkins Jr. wrote on 2015-05-08 17:29:16 +0000.

(In reply to Hayato Ito from comment #8)

(In reply to Tab Atkins Jr. from comment #7)

(In reply to Hayato Ito from comment #6)

Is there any existing clients who use static-profile?
Does it mean '/deep/' can be used in particular APIs?

It's for querySelector()/etc.

Thanks.

Can everyone agree that '/deep/' is okay to be used in querySelector()?

I think we are assuming that adding something to static profile is
zero-overhead to the performance of dynamic profile.

Correct. At worst, it's a check during grammar verification, to note that this isn't valid in the current context and so the selector should be considered grammar-violating.

[Shadow]: Make event retargeting optional (bugzilla: 28444)

Title: [Shadow]: Make event retargeting optional (bugzilla: 28444)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28444


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28444#c0
Dimitri Glazkov wrote on 2015-04-08 16:00:41 +0000.

From https://lists.w3.org/Archives/Public/public-webapps/2015AprJun/0052.html

Annevk: "I think opt-in (or only
with isolated) would be better and perhaps if the API needs to change
anyway we can do that, but we could probably live with opt-out as
well. When you use shadow DOM to compose, global reasoning about state
and events is a fairly established pattern that we should enable."


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28444#c1
Dimitri Glazkov wrote on 2015-04-08 18:27:59 +0000.

As far as I understand, the event.path is the mechanism to enable global reasoning about events. Optional event retargeting seems to be only complicating already complex algos. Consider a scenario where you have a mix of trees with and without retargeting.


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28444#c2
Anne wrote on 2015-04-13 09:32:36 +0000.

Yeah, which is why perhaps we should only do retargeting if the tree is explicitly closed. (Isolated would also have to do it of course.)

That seems like a much more logical model and allows for event.path and event.target to be consistent. The current approach seems a lot like the originalTarget approach from XBL.


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28444#c3
Dimitri Glazkov wrote on 2015-04-13 17:42:47 +0000.

(In reply to Anne from comment #2)

Yeah, which is why perhaps we should only do retargeting if the tree is
explicitly closed. (Isolated would also have to do it of course.)

This suggestion is interesting, but it is orthogonal to the complexity concern. I would still need extra branch points in the retargeting algos in order to account for nested trees that interleave the setting with and without retargeting (whether or not coupled to the closed/open setting), plus the extra transitive complexity of managing insertion points.

That seems like a much more logical model and allows for event.path and
event.target to be consistent. The current approach seems a lot like the
originalTarget approach from XBL.

Can you explain a bit more why event.path seems bad? As far as I can tell, it works well for consumers with event delegation needs.


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28444#c4
Dimitri Glazkov wrote on 2015-04-13 18:01:23 +0000.

+dfreedm to comment on the coupling of closed/open and retargeting opt-in idea.


comment: 5
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28444#c5
Daniel Freedman wrote on 2015-04-13 22:17:16 +0000.

I think retargeting events for "open" shadowroots is still the right paradigm.

When composing elements with ShadowRoots together, it is far more useful to think of those elements as one whole, rather than their constituent pieces.
With retargeting, a developer can use very simple event delegation in their own scope with event.target for discrete composition points, rather than some more complicated ancestry checking.

For example:

If I have a fancy tab bar that controls content

#shadow-root #shadow-root Tab One! (..snip..) Tab Two!

and click on the first tab, with retargeting I can just check event.target === #one to show the associated content.

With event retargeting, each composition boundary can have this simple event delegation construct and be very intuitive for development.

I see event.path as more useful for a global event delegation mechanism, such as for determining desired scrolling behavior with touch events:

for (var i = 0, el; el = touchEvent.path[i]; i++)
if (el._shouldStopScrolling)
touchEvent.preventDefault();


comment: 6
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28444#c6
Hayato Ito wrote on 2015-04-27 03:17:25 +0000.

Let me move this bug to v2 since it is not a blocker for v1.

node.isConnected

Title: [Shadow]: Need mechanism to tell if an element in a ShadowRoot has been inserted into the Document (bugzilla: 22141)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22141


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22141#c0
Daniel Freedman wrote on 2013-05-22 18:23:02 +0000.

Because of necessity of encapsulation, it is very hard to tell if an arbitrary element has been inserted into the document.
Blink current hides the insertion state from compareDocumentPosition,but document.contains will return the actual insertion state.
This seems fine to me, because contains would not leak the state of the surrounding elements like compareDocumentPosition would.
I can also imagine cases where user code may want to gate on the insertion state, such as updating a canvas.


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22141#c1
Dominic Cooney wrote on 2013-06-21 04:27:34 +0000.

Because the author has to have the node in question in hand, it seems like document.contains returning an accurate value for elements in Shadow DOM violates the letter of encapsulation but not the spirit.

I think document.contains should return a value reflecting whether the argument is in the document (including shadow trees.)


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22141#c2
Dimitri Glazkov wrote on 2013-06-21 15:00:58 +0000.

(In reply to comment #1)

Because the author has to have the node in question in hand, it seems like
document.contains returning an accurate value for elements in Shadow DOM
violates the letter of encapsulation but not the spirit.

I think document.contains should return a value reflecting whether the
argument is in the document (including shadow trees.)

That's a neat way to look at the problem. I am convinced.


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22141#c3
Erik Arvidsson wrote on 2013-08-01 20:05:42 +0000.

I think this is the wrong solution. contains has always meant that I can walk from the node's parentNode to the ancestor. This changes the semantics of contains.

What is the scenario we are trying to solve? Figuring that out, we can then come up with a reasonable API without changing the semantics of existing methods.

Let me flip the coin a bit. I've been using contains as a signal that the node is not in the main document (in a shadow tree or a disconnected tree).


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22141#c4
Jan Miksovsky wrote on 2013-10-24 23:14:53 +0000.

I ran across this issue this week, and Daniel pointed me at this bug. See the thread at https://groups.google.com/forum/#!topic/polymer-dev/mGs_zkA_7-4.

Erik was asking for a scenario, and this thread presents one. An overlay (popup) element wants to track and/or absorb all clicks on the document. Clicks outside the overlay should dismiss the overlay, while clicks inside the element should have no effect. The overlay author wires up a click handler on the document, capturing events so that it gets first crack at them (and stop them before they might inadvertently triggering other handlers). The overlay's click handler looks at the event target to decide whether the target is in the overlay or not. For this purpose, the developer decides to use contains(). The dev tests the overlay's click tracking behavior with light DOM content inside the overlay, and all works well.

Later, someone else (me) tries to include the overlay element in the shadow of another element, and distribute content into the overlay. When the user looks at the overlay, they see content presented inside the overlay. From the user's point of view, the overlay contains the content. However, if the user clicks on the (light DOM) content, the overlay's contains() check fails, and the overlay fails to behave properly.

One could argue the overlay element should be written differently. Maybe it could track clicks outside using capturing and track clicks inside using bubbling, or find some other solution. But I think the dev made a reasonable call to use contains() for this purpose, and it seemed to work for any tests they cared to make. It was only when the overlay element was subsumed into the shadow of another element that things broke.

I'll hazard that similar issues are likely to come up wherever a dev tries to use contains() within a custom element. Subsuming that element into the shadow of another element will cause problems. I believe custom elements will have a general need to know whether they (visually) contain a given element, regardless of whether the element is in their shadow or distributed to them.

How this is done, whether through modifying contains() or something new, I'll leave to people wiser than me to figure out.


comment: 5
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22141#c5
Hayato Ito wrote on 2013-10-25 04:09:07 +0000.

I think we can simulate the proposed contains() in JavaScript by using InsertionPoint.getDistributedNodes() and Node.getDestinationInsertionPoints().
I am aware that this will be burden for users, but it could be possible though I've not tried.

I don't think it's good idea to change the semantics of existing contains(). It should consider only a node tree and should ignore the status of the composed tree.

I am not against adding something new in native Shadow DOM if we need it absolutely.


comment: 6
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22141#c6
Daniel Freedman wrote on 2014-03-11 18:30:42 +0000.

Unfortunately, I think this is a very bad user experience decision.

Yes, we would be breaking the written semantics of document.contains, but we would be keeping the developer expectation that document.contains(node) means "this node is in the document".

Otherwise we've broken the developer assumptions about this method, and introduced a whole new variety of bugs.

For example, the jQuery flot charting library draws a helpful chart hover target that follows the mouse. It uses document.contains to determine if it should add page scroll offsets to the mouse x/y position to draw the the target correctly.

In the Polymer ShadowDOM polyfill, we followed the spec, and it broke this library: Polymer/polymer#162.

Ember is another library that uses document.contains to determine if an element should instantiate its controller: https://github.com/Polymer/ShadowDOM/issues/365

Even if we made a new function that does what we want, like Node.prototype.isInDocumentForReals, we still have to knock on all the library authors doors to get them to use the new method, or they say "ShadowDOM broke my stuff, it sucks" and everybody loses.

Web developers need their tools to work, and making document.contains continue to follow developer expectations seems like winning all around.

WDYT?


comment: 7
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22141#c7
Hayato Ito wrote on 2014-03-12 04:55:06 +0000.

To interpret the current spec literally, I think:

  • document.contains should always return false if the argument node is in a shadow tree, as Erik said in comment #3. There is no ancestor/descendant relationship if they are in the different node trees.

I understand that this might cause a very bad user experience.

How do we proceed? Let me propose some ideas.

A) Change the semantics of node.contains so that it should consider the tree of trees.
That means we are extending ancestor/descendant relationships beyond one node tree. I am afraid that we have to do monkey-patch to node.contains in the Shadow DOM spec.

B) Leave node.contains as is. That means if the context object and argument node are in the different node trees, it always returns false.

As alternative, we should provide a new API, such as node.inComposedTree(). node.inComposedTree return true if and only if:
The node participates in the composed tree whose root node is document.

C) Better ideas are welcome.


comment: 8
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22141#c8
Hayato Ito wrote on 2014-03-12 06:02:35 +0000.

FYI.

In blink, looks like the semantics of node.contains changed in
https://chromiumcodereview.appspot.com/21123005

However, we don't have any spec for that. I'm not convinced with decision.

I prefer Idea B. WDYT?


comment: 9
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22141#c9
Hayato Ito wrote on 2014-03-13 05:07:45 +0000.

If we go for idea B, we need API to satisfy the original requirement.

Because node.inComposedTree() is just an tentative idea, I appreciate opinions for better API to satisfy the requirement.

Other ideas:

  • document.containsInComposedTree(node) - I think this is preferred.

Any ideas are welcome!


comment: 10
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22141#c10
Elliott Sprehn wrote on 2014-03-15 02:12:08 +0000.

(In reply to Hayato Ito from comment #9)

If we go for idea B, we need API to satisfy the original requirement.

Because node.inComposedTree() is just an tentative idea, I appreciate
opinions for better API to satisfy the requirement.

Other ideas:

  • document.containsInComposedTree(node) - I think this is preferred.

Any ideas are welcome!

I think there's two separate questions here, Document.contains and Node.contains seem like totally separate questions.

"Am I in this Document"
"Am I a child of this Node"

Now that we have ShadowRoot.host you can actually walk up to the root and get the answer you want though, so perhaps reverting this is okay. We should probably add an inDocument() method though.


comment: 11
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22141#c11
Hayato Ito wrote on 2014-03-17 04:44:16 +0000.

FYI,
In blink, I've reverted the change of "node.contains": https://codereview.chromium.org/197283016/

(In reply to Elliott Sprehn from comment #10)

(In reply to Hayato Ito from comment #9)

If we go for idea B, we need API to satisfy the original requirement.

Because node.inComposedTree() is just an tentative idea, I appreciate
opinions for better API to satisfy the requirement.

Other ideas:

  • document.containsInComposedTree(node) - I think this is preferred.

Any ideas are welcome!

I think there's two separate questions here, Document.contains and
Node.contains seem like totally separate questions.

"Am I in this Document"
"Am I a child of this Node"

Agreed. IMO, we should avoid such a double meaning.
We should have a more explicit API instead of re-using 'document.contains'.

Now that we have ShadowRoot.host you can actually walk up to the root and
get the answer you want though, so perhaps reverting this is okay. We should
probably add an inDocument() method though.

Yeah, we should discuss further to pursuit a good API.
I'd like to hear opinions from developers to address their use cases.


comment: 12
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22141#c12
Hayato Ito wrote on 2014-08-06 08:23:58 +0000.

Because we already have /deep/ combinator, http://drafts.csswg.org/css-scoping/#selectordef-deep, I think document.deepContains(node) might be a good name.

WDYT? If it's okay, let me spec that.


comment: 13
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22141#c13
Hayato Ito wrote on 2014-08-06 08:37:35 +0000.

It seems that Document doesn't have contains.
http://dom.spec.whatwg.org/#interface-document

We should add deepContains to Node, instead of Document.
http://dom.spec.whatwg.org/#dom-node-contains


comment: 14
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22141#c14
Hayato Ito wrote on 2014-08-07 05:37:19 +0000.

I've added 'Node.deepContains(Node? other)' in
14322e5

I need a feedback.
Could someone verify whether this definition satisfies our requirements or not?


comment: 15
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22141#c15
Olli Pettay wrote on 2014-08-07 09:56:50 +0000.

I don't really like deepContains (partly because I think CSS is wrong by exposing
shadow dom in that way, and also because 'deep' doesn't really say anything.)

Couldn't we change contains() to take second param, which could be
some dictionary.

bool contains(Node? other, optional ContainsFilter filter)

dictionary ContainsFilter
{
bool includeShadowDOM = false; // includeShadowDOM is a bit bad name.
}


comment: 16
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22141#c16
Hayato Ito wrote on 2014-08-11 03:08:26 +0000.

Thank you for the feedback!

(In reply to Olli Pettay from comment #15)

I don't really like deepContains (partly because I think CSS is wrong by
exposing
shadow dom in that way, and also because 'deep' doesn't really say anything.)

Couldn't we change contains() to take second param, which could be
some dictionary.

bool contains(Node? other, optional ContainsFilter filter)

dictionary ContainsFilter
{
bool includeShadowDOM = false; // includeShadowDOM is a bit bad name.
}

It looks better to me than deepContains. I like it.
If no one have better idea than this, I'l change the spec.
In this case, should I make a patch for DOM spec?


comment: 17
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22141#c17
Anne wrote on 2014-08-25 08:12:30 +0000.

Well, includeShadow or some such could work. Or includeShadowNodes. Let's not use the term "DOM" in any API. Ideally, the terms we use for shadow nodes are consistent in some way.


comment: 18
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22141#c18
Hayato Ito wrote on 2014-08-25 08:35:46 +0000.

Well, actually, the Shadow DOM spec doesn't define any technical definition of 'Shadow DOM'. That isn't well defined term. We should avoid using the term of 'Shadow DOM' in APIs.

includeNodesInShadowTrees might be the most unambiguous, however it looks too redundant.

My preferences are:

  • Most preferred -

A. includeShadow
B. includeShadowTrees
C. includeNodesInShadowTrees
D. includeShadowNodes

  • Least preferred -

I don't have a strong opinion either. I am aware this might be bike-shed discussion, but the naming of API is important.


comment: 19
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22141#c19
Anne wrote on 2014-08-25 08:40:45 +0000.

includeShadow seems fine. Shortest and to the point. So I guess we'll have shadow trees and the one <textarea> and friends use are isolated shadow trees? (And won't be exposed here of course.)


comment: 20
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22141#c20
Hayato Ito wrote on 2014-08-25 09:02:57 +0000.

Good question.

IMO, document.contains(nodeInShadowTreesHostedByTextAreaElementInDocument, { includeShadow: treu}) should return true. However, I'm not confident.

I am not sure whether there is a use case for that, assuming external developers can't get an access for such a node usually.

AFAIK, only use cases I've heard so far is for nodes which are in user-created shadow trees, rather than nodes in UA shadow trees for built-in elements.

If I misunderstand your question, please correct me.


comment: 21
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22141#c21
Pedram Emrouznejad wrote on 2015-02-15 17:33:11 +0000.

For what's it worth, I managed to solve my need for a document.contains that cuts across shadow boundaries by doing:

element.matches(':host-context(body) *')

(essentially, I needed to know if a shadow-nested element was in the main document)

+1 to a more versatile document.contains though. I'm not sure what other possible options a dictionary would be good for, so I think just a simple true/false as the second parameter would work well. If there is need for further config in the future, then I guess you can still keep the true/false parameter and overload it with a dictionary.

[Shadow]: Declarative Shadow DOM (bugzilla: 28441)

Title: [Shadow]: Declarative Shadow DOM (bugzilla: 28441)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28441


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28441#c0
Dimitri Glazkov wrote on 2015-04-08 15:49:50 +0000.

From: https://lists.w3.org/Archives/Public/public-webapps/2015AprJun/0052.html

"Mostly for performance it would be nice if
the composed tree could be serialized and cached. That way first
render only requires HTML and CSS with JavaScript kicking in at the
end. We reasoned it might not be too hard to add something like
given our experience with . The only difference
would be that itself would also not be appended to the
tree and that the DocumentFragment nee ShadowRoot is associated with
"its parent"."


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28441#c1
Dimitri Glazkov wrote on 2015-04-08 16:21:10 +0000.

Here's a fairly simple implementation of this using custom elements and templates: http://jsbin.com/xuheb/4/edit

I think this is a great example of:

a) using type extensions to avoid more hard-coded parsing behaviors

b) extensible web in action -- no need to wait on spec/browsers to ship this

c) custom element upgrades being helpful in avoiding additional tree traversals and deferring running of the script until whenever you actually need the tree.

[Shadow]: Shadow DOM-based components could benefit from a way to detect when light DOM contents change (bugzilla: 21149)

Title: [Shadow]: Shadow DOM-based components could benefit from a way to detect when light DOM contents change (bugzilla: 21149)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=21149


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=21149#c0
Jan Miksovsky wrote on 2013-02-28 00:25:33 +0000.

Currently, a Shadow DOM-based component has no easy way to know when its own light DOM contents change. This hampers the ability to handle a number of common UI component scenarios.

Background: in evaluating Shadow DOM and custom element support in the QuickUI framework (http://quickui.org), it was discovered that Shadow DOM-based components don't have an easy way to receive notification when their light DOM contents change. Using the large existing QuickUI component library as a reference point, the ability to detect content changes appears to be a common need. See http://blog.quickui.org/2012/04/27/how-quickui-controls-use-code-to-specialize-the-handling-of-their-content-in-ways-that-might-not-be-supported-by-web-components/ for a summary of these scenarios. In QuickUI's case, approximately 25% of the UI components require some notification when their contents change, suggesting that many other components will have this requirement as well.

While a component can work around this by wiring up a Mutation Observer to its own host element, that is fairly cumbersome. Moreover, such an observer would catch more changes than may be strictly be interesting to the component. E.g., if a component is grabbing a specific subset of the light DOM nodes, then it only needs to know when those specific nodes change. (Here, "change" could be: the set of nodes change, or the contents of those nodes change.)

It would be beneficial if Shadow DOM-based components could more easily ask for notification when their contents change. I'm not sure what the best form for this would be. I'm also not sure whether this is best handled as a general Shadow DOM feature, or as a helper only available to custom elements. Custom elements already have an attributeChanged lifecycle method; perhaps there could also be a contentChanged lifecycle method.

I've discussed this idea with Dimitri Glazkov in email, who asked me to file a spec bug to track it.


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=21149#c1
Dominic Cooney wrote on 2013-02-28 21:36:42 +0000.

I was thinking about this problem recently. I think Mutation Observers would work well for this, something like:

var host = ...;

// Create ShadowRoot
var shadow = host.createShadowRoot();

// Populate ShadowRoot
var template = ...;
shadow.appendChild(template.content);

// Observe light DOM changes
var observer = new MutationObserver(function (mutations) {
// Distribution may have changed; do imperative updates
[].forEach.call(shadow.querySelectorAll('content'), function (content) {
// Use content.getDistributedNodes()
});
});
observer.observe(host, { subtree: true, attributes: true, childList: true });

(This over-observes to make this code succinct, but it is possible to use two observers to observe precisely what changes can affect distribution.)


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=21149#c2
Jan Miksovsky wrote on 2013-07-17 17:39:21 +0000.

I'm working around this problem using an observer, but still feel like this is a general need. I've just posted a bit about this at https://groups.google.com/forum/#!topic/polymer-dev/Pq00wMmuPIw.


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=21149#c3
Travis Leithead [MSFT] wrote on 2015-02-24 00:54:00 +0000.

I also agree that this is a general need.

The current use-cases are all dealing with the problem from externally to the component, or from a POV where the host environment has full control/access to the shadowroot. In a possible world of more controlled isolation, especially where a component may only have limited access to its host, some form of change notifications would be handy. I don't have an idea of what these might look like, but the custom element's lifecycle methods could be a starting point...


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=21149#c4
Anne wrote on 2015-04-23 19:13:08 +0000.

*** Bug 24861 has been marked as a duplicate of this bug. ***

[Shadow]: Update constraints around stopping events (bugzilla: 20247)

Title: [Shadow]: Update constraints around stopping events (bugzilla: 20247)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20247


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20247#c0
Dimitri Glazkov wrote on 2012-12-05 15:27:41 +0000.

"The following events must always be stopped at the nearest shadow boundary:"

Since we relaxed the lower boundary in regard to events, we should similarly not stop events there.


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20247#c1
Dimitri Glazkov wrote on 2012-12-05 15:31:06 +0000.

Also, this needs to account for the nodes, distributed to the insertion point. Events from those should be heard outside of the shadow tree.


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20247#c2
Dimitri Glazkov wrote on 2012-12-05 17:54:57 +0000.

And we need to write down the rationale behind stopping these events.


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20247#c3
Dimitri Glazkov wrote on 2012-12-06 23:08:37 +0000.

I am trying to come up with a general rule of thumb. I guess is something like:

If the event is retargeted, does event's meaning change?

For example, if a "load" event is heard at a shadow host, it conveys the meaning of shadow host somehow completing loading, which is not true, because all it means that some element inside of host's shadow tree has completed loading.

Conversely, if an "click" event is heard a a shadow host, it says that the shadow host was clicked. Since shadow tree is how shadow host is rendered, the meaning of the event stays the same.

WDYT?


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20247#c4
Anne wrote on 2012-12-07 10:50:53 +0000.

But if the shadow tree actually did load something via XMLHttpRequest and wanted to convey that you're lost.

I suppose the current set of events is based on what WebKit needed? It seems unclear that will match the needs of developers when this gets out in the wild.


comment: 5
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20247#c5
Dimitri Glazkov wrote on 2012-12-07 16:42:25 +0000.

(In reply to comment #4)

But if the shadow tree actually did load something via XMLHttpRequest and
wanted to convey that you're lost.

Then just fire a "load" event on the shadow host?

I suppose the current set of events is based on what WebKit needed? It seems
unclear that will match the needs of developers when this gets out in the
wild.

We only wanted to stop a "selectstart" in WebKit. The rest of the list is based on Microsoft's experience with HTC:

https://www.w3.org/Bugs/Public/show_bug.cgi?id=15804


comment: 6
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20247#c6
Dimitri Glazkov wrote on 2012-12-07 23:58:17 +0000.

From a thread on whatwg: http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-December/038283.html

It sounds though like you'd want a different approach to this. What if
I have a

Then you probably don't want the "load" events of

It's an interesting question, though. Along with "load", such implementation detail may dispatch a whole bunch of other events (http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#mediaevents).

Most of these events--at least, following my reasoning--seem like they should just be kept in the shadow tree.

I wonder if we would be better off reversing the condition and stopping ALL events, except a set of events whose meaning stays clear after retargeting (like "click").


comment: 7
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20247#c7
Dimitri Glazkov wrote on 2012-12-07 23:59:22 +0000.

*** Bug 20248 has been marked as a duplicate of this bug. ***


comment: 8
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20247#c8
Dimitri Glazkov wrote on 2013-04-01 23:21:07 +0000.

Also interesting comments in bug 20633.


comment: 9
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20247#c9
Dimitri Glazkov wrote on 2013-04-01 23:21:12 +0000.

*** Bug 20633 has been marked as a duplicate of this bug. ***


comment: 10
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20247#c10
Anne wrote on 2013-04-02 08:29:11 +0000.

http://lists.w3.org/Archives/Public/public-webapps/2013JanMar/thread.html#msg312 is how we should solve this imo.


comment: 11
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20247#c11
Dimitri Glazkov wrote on 2013-05-08 17:44:43 +0000.

Bug 21269 has a great discussion around use cases to arbitrarily control event stopping.


comment: 12
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20247#c12
Dimitri Glazkov wrote on 2013-05-08 17:45:13 +0000.

*** Bug 21269 has been marked as a duplicate of this bug. ***


comment: 13
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20247#c13
Dimitri Glazkov wrote on 2013-07-17 22:02:55 +0000.

*** Bug 21400 has been marked as a duplicate of this bug. ***


comment: 14
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20247#c14
Steve Orvell wrote on 2013-09-26 00:25:33 +0000.

A polymer user had a question about this today which prompted some discussion (www.polymer-project.org).

I think at the least the spec needs to be updated to explain the logic behind stopping events. Most of the events that are stopped are non-bubbling events (except 'change'). Since these don't bubble, why must they be stopped? Is this to prevent capturing?

Stopping events poses some problems:

  1. Are the events stopped entirely by name? For example, if a synthetic event is dispatched called 'load' will it be stopped? If so, that seems bad.
  2. In the context of custom elements, the developer may want control over whether or not the event stops at the shadowDOM boundary.

In light of this complexity, it seems like a more complex api would be needed to be able to hide shadow events effectively.

Instead of introducing this complexity, perhaps we can remove the concept of stopped events entirely and instead rely on bubbling behavior. Non-bubbling events will naturally not propagate outside shadowRoot. Events that are captured would just be retargeted.


comment: 15
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20247#c15
Hayato Ito wrote on 2015-02-13 08:28:28 +0000.

I've added a like to this issue to the spec:

aa322cb


comment: 16
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20247#c16
Hayato Ito wrote on 2015-02-13 08:29:01 +0000.

(In reply to Hayato Ito from comment #15)

I've added a like to this issue to the spec:

https://github.com/w3c/webcomponents/commit/
aa322cb

s/like/link/.


comment: 17
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20247#c17
Anne wrote on 2015-04-23 18:43:53 +0000.

The solution here is to add a bit flag to the event dispatch algorithm whether or not the event needs to be scoped to the shadow tree. And then set it in specifications from all the relevant features, such as e.g. 's load & error events.

[Shadow]: Each section on the spec needs examples (bugzilla: 24639)

Title: [Shadow]: Each section on the spec needs examples (bugzilla: 24639)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24639


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24639#c0
Dimitri Glazkov wrote on 2014-02-12 23:49:46 +0000.

For example:

  • multiple shadow roots per host translate to the inheritance model in DOM.
  • what happens when you change the value of the select attribute (show that it's dynamic)

comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24639#c1
Hayato Ito wrote on 2014-02-14 08:07:00 +0000.

Event retargeting example was rewritten in:
http://www.w3.org/Bugs/Public/showdependencytree.cgi?id=14978

Let me add more examples for other sections.


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24639#c2
Hayato Ito wrote on 2014-05-29 07:43:45 +0000.

*** Bug 22201 has been marked as a duplicate of this bug. ***

[Shadow]: Shadow DOM V2 (bugzilla: 15480)

Title: [Shadow]: Shadow DOM V2 (bugzilla: 15480)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15480


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15480#c0
Dimitri Glazkov wrote on 2012-01-10 00:09:22 +0000.

Umbrella bug for tracking all of the "wouldn't it be awesome" ideas.


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15480#c1
Dimitri Glazkov wrote on 2015-04-23 18:36:24 +0000.

Re-purposing as a bucket for post-v1 bugs.

[Shadow]: Consider not using AT_TARGET more than once in the event path (bugzilla: 26892)

Title: [Shadow]: Consider not using AT_TARGET more than once in the event path (bugzilla: 26892)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26892


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26892#c0
Dimitri Glazkov wrote on 2014-09-23 15:36:32 +0000.

I was wrong in bug 15543. The effect of invoking event listeners with AT_TARGET at each shadow host along the event path is that even non-bubbling events appear to bubble.

This is especially evident in situations where logical units of an application are composed using Shadow DOM. Here's a simple example:

I am building a grocery list app. Suppose I am currently making the grocery list editor. The EDIT ITEM dialog box is in its own shadow tree. Inside of this box, I have input fields, as well as a CANCEL button and a DELETE button.

Clicking CANCEL fires a simple 'cancel' event on the EDIT ITEM's shadow host. The event is meant to be listened to by the owner of the EDIT ITEM dialog box (to close it, presumably).

Clicking DELETE opens another CONFIRM DELETE dialog (also in a shadow tree) on top of the EDIT ITEM dialog. That dialog has OK and CANCEL as well.

Suppose that I repeat my event pattern on the CONFIRM DELETE dialog. Clicking CANCEL there fires a simple 'cancel' event. The idea is that my EDIT ITEM dialog can listen to this event and close the CONFIRM DELETE dialog.

Sounds simplistic enough, right? Here's where things get interesting.

Unfortunately for me, when I click on CANCEL in the CONFIRM DELETE dialog, my EDIT ITEM dialog goes away as well!

The reason for this strange occurrence is because, despite 'cancel' being a simple event, the AT_TARGET listener invocation occurs both at the CONFIRM DELETE shadow host and at the EDIT ITEM shadow host.

In other words, the bubbling event listener that is only supposed to hear EDIT ITEM's 'cancel' event will also hear the CONFIRM DELETE's 'cancel' event -- even though I, the developer, specifically told this event not to bubble.

Now I have no choice but work around this problem by attempting to distinguish different 'cancel' events that are coming through.

I think the solution to this conundrum is the same as the one for the bug 20247.


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26892#c1
Olli Pettay wrote on 2014-09-23 16:26:29 +0000.

No, events don't appear as bubbling in the scope of the host. What happens
under the host doesn't matter. If a "cancel" is dispatched there, then
it is supposed to look like its target is actually the host.

Capturing event listeners should fire during capture phase, and
phase should be at_target is currentTarget == target.
bubbling event listeners would then fire during bubble phase, and
phase would be at_target when currentTarget == target.

I don't quite see what bubbling actually have to do with your example.
What if web page uses capturing listeners? You'd have the same issue even
if bubbling would stop earlier.

What we may need is some way to say that events x,y,z shouldn't propagate out from the shadow dom, either in capture or bubble phase.


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26892#c2
Dimitri Glazkov wrote on 2014-09-24 16:23:18 +0000.

(In reply to Olli Pettay from comment #1)

No, events don't appear as bubbling in the scope of the host. What happens
under the host doesn't matter. If a "cancel" is dispatched there, then
it is supposed to look like its target is actually the host.

Capturing event listeners should fire during capture phase, and
phase should be at_target is currentTarget == target.
bubbling event listeners would then fire during bubble phase, and
phase would be at_target when currentTarget == target.

Yes, this is all good. I was there, remember? :)

I don't quite see what bubbling actually have to do with your example.
What if web page uses capturing listeners? You'd have the same issue even
if bubbling would stop earlier.

Take your browser eng hat off for a minute and put your average webdev hat on.

As an average web dev, you only have a vague idea what the hell capturing listener is. You mostly do element.addEventListener(name, handler).

So you have this app structure (idealized/simplified):

grocery-app.html:
...

#shadow-root
...

#shadow-root
...
...

<script> ... var editGroceryItem = document.querySelector('edit-grocery-item-dialog'); editGroceryItem.addEventListener('cancel', function() { console.log('CANCEL: closing edit grocery item!'); ... }); ... var confirmDelete = editGroceryItem.shadowRoot.querySelector('confirm-delete-dialog'); confirmDelete.addEventListener('cancel', function() { console.log('CANCEL: closing confirm!'); }); ... // when CANCEL button in the confirm delete dialog is clicked... buttonInsideConfirmDeleteDialog.dispatchEvent(new CustomEvent('cancel')); </script>

Now, as a webdev, you'll be surprised (and probably frustrated) to find out that you ALWAYS get both event handlers invoked when you click on the cancel delete button. You'll be like "whaaa? I just wanted to close the confirm delete dialog. You stupid SOB, why are also closing my edit item dialog?"

The web developer's expectation that the event doesn't bubble, and that whole AT_TARGET mumbo jumbo that you and I are painfully aware of is but a faint nagging feeling that something's gone terribly wrong.

What we may need is some way to say that events x,y,z shouldn't propagate
out from the shadow dom, either in capture or bubble phase.

Yes! That's what I said in the first comment! :)


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26892#c3
Olli Pettay wrote on 2014-09-24 16:33:09 +0000.

(In reply to Dimitri Glazkov from comment #2)

What we may need is some way to say that events x,y,z shouldn't propagate
out from the shadow dom, either in capture or bubble phase.

Yes! That's what I said in the first comment! :)
I don't see it mentioned in the first comment ;)

I'm thinking some API like
interface ShadowRoot {
...

void setEncapsulatedEvents(sequence types);
}
That would prevent propagation of those events in case the event is originally
from somewhere under the shadow tree (i.e. shadowhost.contains(event.target) would return false or so)


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26892#c4
Olli Pettay wrote on 2014-09-24 16:34:07 +0000.

And yes, the method name in the example is horrible, something better should be used.


comment: 5
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26892#c5
Hayato Ito wrote on 2015-04-22 22:29:23 +0000.

If we are pursuing something like "void setEncapsulatedEvents(sequence types)", can we merge this issue to https://www.w3.org/Bugs/Public/show_bug.cgi?id=20247 ?

I think both topics are related. I'd like to have one good idea which resolves both.


comment: 6
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26892#c6
Dimitri Glazkov wrote on 2015-04-23 18:21:42 +0000.

*** Bug 28246 has been marked as a duplicate of this bug. ***

[Shadow]: elementFromPoint should return the host when you hit a Text node (bugzilla: 24638)

Title: [Shadow]: elementFromPoint should return the host when you hit a Text node (bugzilla: 24638)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24638


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24638#c0
Elliott Sprehn wrote on 2014-02-12 23:33:23 +0000.

Seeing as we don't want to throw an exception when you put a Text node as a child of a ShadowRoot, we should at the very least return the host element so that hit testing in a ShadowRoot that has direct text children does something sensible.

We probably need to make it return the host if you hit a border/background color too?

(this also makes sense since you can querySelector(":host"), so the host really is in the same scope as the ShadowRoot.


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24638#c1
Daniel Freedman wrote on 2014-02-12 23:57:33 +0000.

This is conceptually similar to the fact that document.elementFromPoint will return the documentElement if the x,y target is within the document's bounds.


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24638#c2
Anne wrote on 2014-02-13 10:05:18 +0000.

Instead of defining it this way, someone should define hit testing on layout boxes.


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24638#c3
Anne wrote on 2014-02-13 10:05:59 +0000.

I'm not sure we want radically different behavior for elementFromPoint() and mouse events and :hover and such for instance.

[Shadow]: Add [TreatNullAs=EmptyString] to ShadowRoot.innerHTML (bugzilla: 28549)

Title: [Shadow]: Add [TreatNullAs=EmptyString] to ShadowRoot.innerHTML (bugzilla: 28549)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28549


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28549#c0
Philip Jägenstedt wrote on 2015-04-23 14:51:48 +0000.

This is how it's implemented in Blink, and it's consistent with Element.innerHTML:
https://dvcs.w3.org/hg/innerhtml/raw-file/tip/index.html#extensions-to-the-element-interface


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28549#c1
Anne wrote on 2015-04-23 16:46:20 +0000.

Is there a bug on moving innerHTML to DocumentFragment? Or was there a problem with that? It seems this kind of infrastructure method should not be restricted to ShadowRoot.


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28549#c2
Anne wrote on 2015-04-23 21:27:39 +0000.

For DocumentFragment there would be no context element. (ShadowRoot uses the host element.)

[Shadow]: There's isn't a way to append shadow elements in SVG (bugzilla: 24181)

Title: [Shadow]: There's isn't a way to append shadow elements in SVG (bugzilla: 24181)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24181


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24181#c0
Philip Rogers wrote on 2013-12-31 00:14:24 +0000.

Multiple shadow roots aren't very useful in SVG because it's not possible to append a shadow element to an SVG element (they are in different namespaces). I think we may need SVGShadowElement to achieve this glorious goal.

A fun historical anecdote:
The only reference I found to "SVGShadowElement" was this post from a decade ago :)
http://lists.w3.org/Archives/Public/www-svg/2003Nov/0085.html


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24181#c1
Tab Atkins Jr. wrote on 2014-01-03 19:36:57 +0000.

Nope, nope nope nope nope nope. We are not adding more "exactly like the HTML element, but with a different interface name" things.

Consider this further impetus for the glorious "just put SVG in the HTML namespace already" future.


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24181#c2
Erik Dahlström wrote on 2014-02-05 09:44:19 +0000.

(In reply to Tab Atkins Jr. from comment #1)

Nope, nope nope nope nope nope. We are not adding more "exactly like the
HTML element, but with a different interface name" things.

Consider this further impetus for the glorious "just put SVG in the HTML
namespace already" future.

I agree that in the best of worlds svg and html would just interleave nicely and everything would just work. However, we do need to make some changes for that to happen.

Issues:

  1. Parsing of the shadow element (and content, template and possibly others). This assumes that the HTML parsing algorithm doesn't break out of "svg-mode" if encountering a shadow/content/template element inside an svg fragment. I expect that if using svg standalone (aka in xml mode) you'd still have to XHTML namespace these elements (horribly ugly, but unless we require some sort of special handling to push the elements into the html namespace that's what we have to do).
  2. Rendering of non-svg elements in an svg context - we need the svg spec to allow and require that at least for the Shadow DOM elements.
    2.1. Note that https://svgwg.org/svg2-draft/embedded.html already imports/renames a bunch of html elements. We should strive to solve these in a similar way.
  3. Assuming the Shadow DOM elements stay in the html namespace and do render in svg, should they (if inside of svg content) have partial interfaces that append some SVG traits like getting the current transform, bbox and so on? Should that be decided on an element to element basis, or should there be a default fallback partial interface?

comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24181#c3
Tab Atkins Jr. wrote on 2014-02-05 15:43:27 +0000.

(In reply to Erik Dahlström from comment #2)

(In reply to Tab Atkins Jr. from comment #1)

Nope, nope nope nope nope nope. We are not adding more "exactly like the
HTML element, but with a different interface name" things.

Consider this further impetus for the glorious "just put SVG in the HTML
namespace already" future.

I agree that in the best of worlds svg and html would just interleave nicely
and everything would just work. However, we do need to make some changes for
that to happen.

Issues:

  1. Parsing of the shadow element (and content, template and possibly
    others). This assumes that the HTML parsing algorithm doesn't break out of
    "svg-mode" if encountering a shadow/content/template element inside an svg
    fragment. I expect that if using svg standalone (aka in xml mode) you'd
    still have to XHTML namespace these elements (horribly ugly, but unless we
    require some sort of special handling to push the elements into the html
    namespace that's what we have to do).

"Standalone" and "XML mode" are not necessarily synonymous. We should continue to push for them to be different, so that SVG is tied to the HTML parser both standalone and when embedded in HTML.

  1. Rendering of non-svg elements in an svg context - we need the svg spec to
    allow and require that at least for the Shadow DOM elements.
    2.1. Note that https://svgwg.org/svg2-draft/embedded.html already
    imports/renames a bunch of html elements. We should strive to solve these in
    a similar way.

Yup, and all of these are a terrible mistake which should be rectified by making them be in the HTML namespace. (I didn't realize we'd imported them :/ )

  1. Assuming the Shadow DOM elements stay in the html namespace and do render
    in svg, should they (if inside of svg content) have partial interfaces that
    append some SVG traits like getting the current transform, bbox and so on?
    Should that be decided on an element to element basis, or should there be a
    default fallback partial interface?

The Shadow DOM elements and aren't ever rendered, so I don't think they need any of those.

[Shadow]: inappropriate reference to CSS3-UI nav-index spec in focus navigation order (bugzilla: 28079)

Title: [Shadow]: inappropriate reference to CSS3-UI nav-index spec in focus navigation order (bugzilla: 28079)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28079


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28079#c0
Takayoshi Kochi wrote on 2015-02-23 05:24:54 +0000.

The current shadow DOM spec specifies the focus navigation order of
elements in the shadow tree using CSS3 UI's "nav-index" property[1](more specifically in its algorithm 1.3.2 and 2.3, the spec refers to
"auto" for nav-index CSS property).

It's better to rewrite this part to refer to HTML spec, rather than
CSS3 UI spec.

The property is considered "at risk" in the CSS3 UI spec, and might not
be adopted as is in the current spec draft. I found some discussion in
CSS WG's meeting notes[2].

As far as I read the CSS3 UI spec, the "auto" value corresponds to the
behavior of HTML attribute "tabindex" with its value 0 (cf, the spec
is [3] or [4]), which is already implemented in most browsers and the
spec is stable.

[1] http://www.w3.org/TR/css3-ui/#nav-index
[2] https://lists.w3.org/Archives/Public/www-style/2015Jan/0406.html
[3] https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute
[4] http://www.w3.org/TR/html5/editing.html#sequential-focus-navigation-and-the-tabindex-attribute

[Shadow]: Consider removal of multiple shadow roots (bugzilla: 28446)

Title: [Shadow]: Consider removal of multiple shadow roots (bugzilla: 28446)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28446


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28446#c0
Dimitri Glazkov wrote on 2015-04-08 16:10:20 +0000.

This is a contentious bit: https://github.com/w3c/webcomponents/wiki/Shadow-DOM:-Contentious-Bits#a-multiple-shadow-roots-per-element


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28446#c1
Dimitri Glazkov wrote on 2015-04-08 16:10:58 +0000.

From https://lists.w3.org/Archives/Public/public-webapps/2015AprJun/0052.html:

Annevk: "We'd like to retain this feature.
Although it has complexity, we've heard from both Firefox UI and
Firefox OS application developers that the moment your library gets
sophisticated, you want this for extensibility."


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28446#c2
Dimitri Glazkov wrote on 2015-04-16 16:42:41 +0000.

From https://lists.w3.org/Archives/Public/public-webapps/2015AprJun/0109.html:

"I was asked to provide a use case for our stance. One that we've found
with Firefox OS is custom dialogs, quoting Wilson Page:

    # I have an <x-dialog> component. It takes care of transitioning
    # in and out of the viewport and appropriate styling contained
    # elements (<h1>, <button>, <p>).
    #
    # I want to be able to extend this component to produce
    # <x-dialog-alert>. In this case extending the prototype alone
    # isn't enough, I need to also be able to extend the markup
    # and styling of <x-dialog>.
    #
    # At the point of creation <x-dialog-alert> can add a second
    # ShadowRoot that allows it to compose its own content
    # inside that of the 'old' <x-dialog> ShadowRoot. Without this
    # <x-dialog-alert> would have to duplicate all the markup, style
    # and interaction code again."

comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28446#c3
Dimitri Glazkov wrote on 2015-04-16 16:45:22 +0000.

From https://lists.w3.org/Archives/Public/public-webapps/2015AprJun/0122.html:

"I don't think you need to duplicate anything. The super class can still
fill in the original shadow root, then the subclass can modify it. This is
the same concept of the prototype inheritance, your methods will shadow the
super class methods, but you can just call them and then extend the
behavior.

This is also the reason the created and attached callbacks are on the
prototype. So you can call super and use the parent behavior by shared
protocol."


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28446#c4
Dimitri Glazkov wrote on 2015-04-16 16:46:04 +0000.

From https://lists.w3.org/Archives/Public/public-webapps/2015AprJun/0132.html:

"> This is an interesting approach that didn't occur to me! Similar to Anne's

concerns, this would require you to have more knowledge of the internals of
the super-class component. If you own both components then this is fine.

Yes, the main problem here is the degree of separation between creator and
consumer of the base component. The higher the degree, the less inclined
the creator will be to expose innards of the shadow tree to the consumer.

Multiple shadow roots solves the same problem as shadow trees (provides a
composition contract), but along the inheritance chain.

For example, multiple shadow roots make sense:

  • if you are a maker of UI library that's strongly rooted in inheritance
    and intend to for your base components to be used directly;
  • if you are hoping to inherit from components with closed shadow trees."

comment: 5
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28446#c5
Hayato Ito wrote on 2015-04-22 22:36:07 +0000.

FYI. I've written a memo about "Multiple Shadow Roots".

https://github.com/w3c/webcomponents/wiki/Multiple-Shadow-Roots-as-%22a-Shadow-Root-hosts-another-Shadow-Root%22

I'm not saying anything about whether we should remove multiple shadow roots or not there. Please consider it just for reference.


comment: 6
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28446#c6
Hayato Ito wrote on 2015-04-27 03:15:33 +0000.

The resolution is "Remove for v1".

See https://www.w3.org/wiki/Webapps/WebComponentsApril2015Meeting.

Let me try to update the spec. I might use this bug as a meta bug.

Selection APIs for Shadow DOM

Title: [Shadow]: Find a way for selection to work across shadow DOM subtrees (bugzilla: 15444)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15444


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15444#c0
Dimitri Glazkov wrote on 2012-01-06 18:40:35 +0000.

As specified in http://dvcs.w3.org/hg/webcomponents/rev/3fb19f98bead, window.getSelection() may never retrieve content from shadow DOM subtrees. Also, a user can't select content from both document tree and shadow DOM tree. We must fix that somehow.


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15444#c1
Dimitri Glazkov wrote on 2012-01-06 20:29:06 +0000.

Should we allow shadow DOM subtrees to specify whether they want to be treated as part of "as-rendered" structure or as a separate subtree?

Currently, for getSelection(), the WebKit implementation returns serialized value of the Selection object inside of a shadow DOM subtree, but node values are adjusted to avoid leaking shadow DOM nodes.


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15444#c2
Steve Orvell wrote on 2013-09-05 01:50:34 +0000.

This is an important UX concern. I think it's fine to limit access to selection data as defined by the spec. However, users expect to be able to select and copy text in a web page. To have that limited by invisible ShadowDOM boundaries would be very annoying. Ideally, this just always works and is separate from the encapsulation provided via ShadowDOM.


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15444#c3
Dimitri Glazkov wrote on 2014-03-06 00:11:06 +0000.

One thing that Jonas suggested at the recent spec review is to make our selection language non-normative. It's a tough subject, so we shouldn't freeze this into the spec. The suggestion was to have the language along these lines:

"Selection is not defined. Implementation should do their best to do what's best for them. Here's one possible, admittedly naive way: <insert current normative wording, but make it informative>"


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15444#c4
Hayato Ito wrote on 2014-03-10 06:09:43 +0000.

(In reply to Dimitri Glazkov from comment #3)

One thing that Jonas suggested at the recent spec review is to make our
selection language non-normative. It's a tough subject, so we shouldn't
freeze this into the spec. The suggestion was to have the language along
these lines:

"Selection is not defined. Implementation should do their best to do what's
best for them. Here's one possible, admittedly naive way: <insert current
normative wording, but make it informative>"

Done at
25bd518.

I'll keep this bug open until we have a better model, that is a tough issue for us.


comment: 5
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15444#c5
Dimitri Glazkov wrote on 2014-03-10 16:07:28 +0000.

(In reply to Hayato Ito from comment #4)

(In reply to Dimitri Glazkov from comment #3)

One thing that Jonas suggested at the recent spec review is to make our
selection language non-normative. It's a tough subject, so we shouldn't
freeze this into the spec. The suggestion was to have the language along
these lines:

"Selection is not defined. Implementation should do their best to do what's
best for them. Here's one possible, admittedly naive way: <insert current
normative wording, but make it informative>"

Done at
https://github.com/w3c/webcomponents/commit/
25bd518.

I'll keep this bug open until we have a better model, that is a tough issue
for us.

Maybe kill the 6.1.1 section title and remove the musty language from the non-normative parts?


comment: 6
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15444#c6
Hayato Ito wrote on 2014-03-11 07:45:41 +0000.

(In reply to Dimitri Glazkov from comment #5)

Maybe kill the 6.1.1 section title and remove the musty language from the
non-normative parts?

Sure. Done at
0887618


comment: 7
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15444#c7
Hayato Ito wrote on 2014-11-19 05:06:12 +0000.

*** Bug 25038 has been marked as a duplicate of this bug. ***


comment: 8
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15444#c8
Hayato Ito wrote on 2015-04-22 21:31:06 +0000.

Status Update: This bug is still on our radar, but we couldn't spend much time on this issue in terms of the spec.

FYI. In Blink, we are working on supporting selection across shadow boundaries 1. However, there is no update on API in the spec yet.

Link to CSS Scoping module spec?

Looking for "scope" or "/deep" or similar terms in the spec doesn't produce any meaningful result--because there is no mention to said selectors in the Shadow DOM spec.

But as a developer I would expect at least a mention to: http://dev.w3.org/csswg/css-scoping/

This is the web, right? we link things together 🌐

[Shadow]: Isolated Shadow trees (bugzilla: 28442)

Title: [Shadow]: Isolated Shadow trees (bugzilla: 28442)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28442


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28442#c0
Dimitri Glazkov wrote on 2015-04-08 15:51:26 +0000.

From https://lists.w3.org/Archives/Public/public-webapps/2015AprJun/0052.html

"Isolated shadow DOM. This is the idea of having a "DOM worker" so
that instead of ten <iframe>s with ten globals you can have one global
with ten somethings. This would give applications more parallelization
opportunities and would hopefully enable a large number of companies
from moving away of the practice of using cross-origin <script> with
all its security implications."


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28442#c1
Dimitri Glazkov wrote on 2015-04-08 16:26:07 +0000.

Old proposal: https://docs.google.com/document/d/1V7ci1-lBTY6AJxgN99aCMwjZKCjKv1v3y_7WLtcgM00/edit?pli=1

[Shadow]: Form elements crossing shadow boundary (bugzilla: 22443)

Title: [Shadow]: Form elements crossing shadow boundary (bugzilla: 22443)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22443


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22443#c0
Yuta Kitamura wrote on 2013-06-25 06:50:14 +0000.

The Shadow DOM specification should specify the behavior of form elements
if they cross shadow boundary.

Specifically, it should clarify the behavior of pressing a submit button
(or calling submit() method of the input element) in the following cases:

(1)

- - - {shadow-root}
|
+--

(2) - - - {shadow-root}
| |
| +--
|
+--

and encapsulation requirements of the following properties of form elements:

  • HTMLFormElement.elements, length, (unsigned long), (DOMString)
  • HTMLLabelElement.control
  • HTMLInputElement.form (and others)

comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22443#c1
Dimitri Glazkov wrote on 2013-06-25 15:34:38 +0000.

Does this not cover it? http://www.w3.org/TR/shadow-dom/#html-forms


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22443#c2
Yuta Kitamura wrote on 2013-06-26 01:19:01 +0000.

Oops, didn't notice that section. However, the current wording is somewhat
vague:

  • "each shadow tree must scope its form elements and form-associated elements"
    • What does "scope" mean?
  • "the form submission must continue to work as specified"
    • What input elements are considered to be sent when the submit button is
      pressed? For example,

      - - - {shadow-root} | | | +-- | | | +-- | +-- | +--

      What should be sent if one presses the submit button? "x=1&y=2",
      "x=1", or "y=2"? What's the form owner of ?
      What about ?

    • In the example (1) above, element's form owner is null,
      thus pressing the button does nothing; am I correct?


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22443#c3
Dimitri Glazkov wrote on 2013-07-17 20:21:53 +0000.

*** Bug 20320 has been marked as a duplicate of this bug. ***


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22443#c4
Jonas Sicking wrote on 2014-05-05 23:42:21 +0000.

I don't think that s in a Shadow DOM should get any special behavior compared to other s that are not in the document. I.e. I don't think they should submit with a that lives in a document.

See my comment in bug 25562 comment 6 for why.

That said, I think that we should implement the system described here http://lists.w3.org/Archives/Public/public-webapps/2014JanMar/0448.html

And we could even add special features for making it easier to submit s that live in a Shadow DOM. One way to do that would be to add a .formData property on DocumentFragment or ShadowRoot. That way the implementation of .formData on a custom element would simply be

function formData() {
return this.shadowRoot.formData();
}

[Shadow]: Need to define what .styleSheets actually does on a shadow root (bugzilla: 27418)

Title: [Shadow]: Need to define what .styleSheets actually does on a shadow root (bugzilla: 27418)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27418


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27418#c0
Boris Zbarsky wrote on 2014-11-24 14:56:06 +0000.

The spec says:

On getting, the attribute must return a StyleSheetList sequence containing the
shadow root style sheets.

The term "shadow root style sheets" is not defined anywhere. In fact, the string "sheet" does not appear anywhere else in this spec.

This needs to actually be defined, with particular attention to older shadow roots (e.g. do things in older shadow trees even load/parse their stylesheets?).


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27418#c1
Boris Zbarsky wrote on 2014-11-24 14:56:46 +0000.

And in fact, https://bugzilla.mozilla.org/show_bug.cgi?id=1098270#c18 has at least one other case that should be considered.


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27418#c2
William Chen wrote on 2014-11-24 18:13:03 +0000.

There is already a bug for this: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26850


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27418#c3
Boris Zbarsky wrote on 2014-11-24 19:22:46 +0000.

That's not the same bug.

There are two separate issues:

  1. When do stylesheets get created for style/link elements? That's bug 26850.

  2. What appears in the shadow root's .styleSheets and in what order? That's
    this bug.

Figuring out bug 26850 is probably a prerequisite for resolving this one. But once that's done, this bug will still need to define which elements' stylesheets appear in the list, and the order.

Is there going to be a Chinese version?

I was wondering is there any plan for non-english version of the specs.
I'd like to do a Chinese version of these if you're going to accept my pull request.

[Shadow]: Consider explicitly exporting CSS Variables across a shadow boundary (bugzilla: 17143)

Title: [Shadow]: Consider explicitly exporting CSS Variables across a shadow boundary (bugzilla: 17143)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=17143


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=17143#c0
Dimitri Glazkov wrote on 2012-05-21 20:32:51 +0000.

Once CSS Variables are in use, every CSS Variable will come across a shadow boundary, which may lead to unintended consequences. Consider a situation where the shadow DOM subtree is using CSS Variables internally. Now, a CSS variable that's specified externally will stomp on them. Sadface ensues.


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=17143#c1
Dominic Cooney wrote on 2012-06-18 02:57:47 +0000.

I think this case could be more common than just accidental name collisions.

Consider nested use of the same component: Say my network configuration component has a tab strip for WiFi, IPv6, etc. and it is designed to be reused in different contexts. If someone puts it inside another tabstrip for Network, Display, etc. the variables set to configure the outer tabstrip will naturally apply to the inner one. (I think?)

In general someone using a component inside another component, to make their use of that component really reliable, would have to reset the variables around the inner component, which means being fully aware of its default style.

On the other hand, if the component is using variables for theming, the global application is probably what you want.

[Shadow]: url fragment identifiers should be followed into ShadowDOM (bugzilla: 23161)

Title: [Shadow]: url fragment identifiers should be followed into ShadowDOM (bugzilla: 23161)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23161


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23161#c0
Steve Orvell wrote on 2013-09-05 02:16:51 +0000.

Given the following:

  1. a user navigates to: foo.com/#footer
  2. at the requested url inside some shadowRoot we have:
<div>
SR
  <footer id="footer"></footer>

In this case, the #footer resource should be navigated to (page scrolls to it) even though it is inside a shadowRoot. There is one url for a page and it must be shared by all the shadowRoots.

Since id's are scoped inside ShadowDOM, there may be a lot of duplicates page-wide. So, which one should be followed? The answer here is to do what browsers do now in this case: navigate to the first fragment identifier.

deepRelatedTargets and touch.deepTargets

Title: [Shadow] investigate if there should be deepRelatedTargets and touch.deepTargets (bugzilla: 28560)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28560


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28560#c0
Olli Pettay wrote on 2015-04-26 18:25:01 +0000.

.


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28560#c1
Hayato Ito wrote on 2015-04-27 01:30:58 +0000.

The motivation is that we can't use event.deepPath[0] in either case, isn't it?


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28560#c2
Anne wrote on 2015-04-27 03:06:02 +0000.

Yes, these properties are changed but their original values are not otherwise exposed.

(There might also be value in event.deepTarget as a clearer event.deepPath[0], just like event.target is short for a conceptual event.path[0]...)


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28560#c3
Anne wrote on 2015-04-27 11:25:19 +0000.

Also:

deepOffsetX/Y

[Shadow]: how is the autofocus attribute supposed to be handled? (bugzilla: 27757)

Title: [Shadow]: how is the autofocus attribute supposed to be handled? (bugzilla: 27757)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27757


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27757#c0
Rodney Rehm wrote on 2015-01-05 21:23:37 +0000.

The section "6.2 Focus Navigation" [1] does not specify how the autofocus attribute [2] is to be handled if set on an element within a ShadowRoot.

As of now Chrome and Firefox consider all elements at page load, including the ones in ShadowRoots when looking for an element with autofocus. That, however, is not the behavior I expected from an encapsulated DOM. What I expected is the same behavior the dialog element presents in showModal in steps 8 - 10 [3].

[1] http://w3c.github.io/webcomponents/spec/shadow/#focus-navigation
[2] http://www.w3.org/html/wg/drafts/html/master/forms.html#autofocusing-a-form-control:-the-autofocus-attribute
[3] http://www.w3.org/html/wg/drafts/html/master/interactive-elements.html#dom-dialog-showmodal


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27757#c1
Hayato Ito wrote on 2015-01-06 01:03:17 +0000.

See also bug 26365.


comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27757#c2
Hayato Ito wrote on 2015-01-07 04:37:59 +0000.

To be clear, because the Shadow DOM spec doesn't override how autofocus works at all, the current behavior of Blink looks against the spec.

autofocus is also on the radar on bug 26365.


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27757#c3
Rodney Rehm wrote on 2015-01-07 08:21:06 +0000.

Is it possible to add a note to the focus section saying that autofocus behavior should be the same as if the element with autofocus was a member of the document instead of a ShadowRoot? That wouldn't change current meaning, but make things a bit more clear (for authors, I guess)


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27757#c4
Hayato Ito wrote on 2015-04-15 06:30:18 +0000.

Yes, we can.
Looks the autofocus was mentioned at b9f45ee. However, there is no mention at Focus Navigation section.

We have to fix somehow.

[Shadow]: Define the behavior of *closed* shadow trees. (bugzilla: 27775)

Title: [Shadow]: Define the behavior of closed shadow trees. (bugzilla: 27775)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27775


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27775#c0
Hayato Ito wrote on 2015-01-07 01:12:32 +0000.

The current spec uses a term of 'UA-provided shadow trees'. The spec assumes that built-in elements, such as

For example, in Blink, event.path API returns an array, however, it excludes nodes in UA-provided shadow trees. Unfortunately, the spec doesn't mention this behavior at all. That doesn't look good to me from the view of compatibility if browser vendors would like to use shadow trees to implement their built-in elements.

I am wondering whether it is worth or not to expose this hidden concept, UA shadow trees, clearly in the spec, as a closed shadow tree, a tentative name borrowed from the another thread, so that we can explain the behavior of builtin elements in terms of Shadow DOM. I think this would fill one of missing pieces for 'HTML as Custom Elements' concept.

In Blink, as some of you might know, ShadowRoot object has an enum internally, UserAgentShadowRoot or AuthorShadowRoot. Some builtin elements, such as

The spec should mention the followings, but not limited to:

  • Element.shadowRoot - If the youngest shadow tree is closed, return null. That matches the current Blink's implementation.

  • Element.getDestinationInsertionPoints - must filter out insertion points if they are in a closed shadow tree. That matches the current Blink's implementation. e.g.

  • Event.path - must filter out event targets if it is in a closed shadow tree. (The exact condition is more complex than you imagine).

  • Needs to discuss:
    Whether or not to allow calling Element.createShadowRoot() for the shadow host which has the closed youngest shadow tree.
    If we allow it, we might have to consider the followings also:

    • InsertinonPoint.getDistributedNodes - Filter out nodes in a closed older shadow tree. In Blink, we don't need this because there is not such UA and author shadow trees, I think.
    • ShadowRoot.olderShadowRoot - If the older shadow tree is closed, return null.
  • The behavior of CSS selector which crosses shadow trees.
    '::shadow', '/deep/' - See https://code.google.com/p/chromium/issues/detail?id=433977 also. This should be mentioned in css-scoping spec.

What makes things complex is the case when a closed shadow tree and an open shadow tree are mixed together within one shadow host:

e.g.
A). ShadowHost => the oldest shadow tree (open) => older shadow tree (open) => youngest shadow tree (closed)
B). ShadowHost => the oldest shadow tree (closed) => older shadow tree (closed) => youngest shadow tree (open)

In Blink, there isn't a pattern A so far. We might need to consider this case in the future.

Here, I'm not aiming to expose an API for creating a closed shadow tree to Web developers.
Although this issue might resolve one of pre-requirements for that, as a result, I don't have any idea about how we should prioritize exposing such a API.

If we were to expose the API, the API might be:

  • Element.createShadowRoot take an optional dictionary, such as ({'mode': 'closed'}).

I don't care which the default should be, closed or open. That sounds non-essential to me. That's a domain of API. For compatibility, the default should be 'open', I think.
Please use bug 20144 for this kind of topic.


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27775#c1
Olli Pettay wrote on 2015-01-07 11:22:20 +0000.

(In reply to Hayato Ito from comment #0)

I am wondering whether it is worth or not to expose this hidden concept,
UA shadow trees, clearly in the spec, as a closed shadow tree, a tentative
name borrowed from the another thread, so that we can explain the behavior
of builtin elements in terms of Shadow DOM.
Do we really want that? Wouldn't it bound implementations to use similar structures for
form elements.

In Blink, as some of you might know, ShadowRoot object has an enum
internally, UserAgentShadowRoot or AuthorShadowRoot. Some builtin elements,
such as

But why do we need to spec browser specific behavior? Maybe I'm missing what you're proposing here.

One good thing though is that if 'closed shadow tree' is spec'ed, it might force us to spec
how proper encapsulation and information hiding works.
So maybe we do want it after all, but just not spec what kind of closed shadow tree various elements may have.
That would be up to the UA.
Or... maybe we shouldn't define 'closed shadow tree', but something like
'domain specific shadow tree', and UA would just happen to form a 'system' domain itself.
Assuming 'dsst' would hide information by default, and could opt-in to not-hide, UA shadow DOM would just work
by default. So, I think we want this, and no special 'closed shadow tree'

  • Needs to discuss:
    Whether or not to allow calling Element.createShadowRoot() for the shadow
    host which has the closed youngest shadow tree.
    If we allow it, we might have to consider the followings also:
    I think the end goal should be to allow it. There shouldn't be special cases or inconsistencies.

comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27775#c2
Hayato Ito wrote on 2015-01-08 07:48:46 +0000.

(In reply to Olli Pettay from comment #1)

(In reply to Hayato Ito from comment #0)

I am wondering whether it is worth or not to expose this hidden concept,
UA shadow trees, clearly in the spec, as a closed shadow tree, a tentative
name borrowed from the another thread, so that we can explain the behavior
of builtin elements in terms of Shadow DOM.
Do we really want that? Wouldn't it bound implementations to use similar
structures for
form elements.

Yeah, I thought that "we don't want this" because such a shadow tree has been used as an implementation detail of some of builtin elements. No one should take care of such an implementation detail, basically.
However, the recent movement, 'HTML as Custom Element', made me reconsider this topic again. I feel uncomfortable in the current Shadow DOM spec because the spec can't explain an existence of such an internally-used shadow tree in a well-defined manner, even though the spec mentions it as a UA-provided shadow tree, especially in the Section 8, "HTML Elements and Their Shadow Trees".

In Blink, as some of you might know, ShadowRoot object has an enum
internally, UserAgentShadowRoot or AuthorShadowRoot. Some builtin elements,
such as

But why do we need to spec browser specific behavior? Maybe I'm missing what
you're proposing here.

My bad. It's not a goal to define how a builtin element should be implemented in the spec. That's up to UA.
My intention of filing this issue is just to define the behavior of closed shadow trees clearly. It's up to UA how UA makes use of it. UA doesn't have to use shadow trees if a shadow tree doesn't fit.

But, wait,,, it's against "the Section 8, HTML Elements and Their Shadow Trees".
I think the original goal of Section 8 is to define how some of builtin elements should behave if Web Developers call element.createShadowRoot() for that. That's one of tough issues.

One good thing though is that if 'closed shadow tree' is spec'ed, it might
force us to spec
how proper encapsulation and information hiding works.

Good point. So far, we've succeeded to hide the implementation detail of

So maybe we do want it after all, but just not spec what kind of closed
shadow tree various elements may have.
That would be up to the UA.
Or... maybe we shouldn't define 'closed shadow tree', but something like
'domain specific shadow tree', and UA would just happen to form a 'system'
domain itself.
Assuming 'dsst' would hide information by default, and could opt-in to
not-hide, UA shadow DOM would just work
by default. So, I think we want this, and no special 'closed shadow tree'

An Interesting idea. From the view of such a domain specific shadow tree, I am feeling that the current shadow tree might be considered as one of domain specific shadow tree, where the domain is 'Author'.

We might want to define the default behavior of two instances of domain specific shadow trees, 'System and Author', at least. Any other better interpretation of your idea?

Anyway, I don't have a plan to work on this task soon because I'm not confident about how we should prioritize this task. I've not heard any urgent requests for spec-cing closed shadow trees so far.

  • Needs to discuss:
    Whether or not to allow calling Element.createShadowRoot() for the shadow
    host which has the closed youngest shadow tree.
    If we allow it, we might have to consider the followings also:
    I think the end goal should be to allow it. There shouldn't be special cases
    or inconsistencies.

Agreed. That's exactly the original goal of "Section 8".


comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27775#c3
Philip Jägenstedt wrote on 2015-01-30 06:09:18 +0000.

It would be nice to have closed shadow trees, which the the shadow-piercing combinator '>>>' cannot reach into and whose internal structure is otherwise entirely opaque to the containing document. Things like

We could perhaps also allow script-created shadow trees to be closed, although defaulting to open.


comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27775#c4
Olli Pettay wrote on 2015-01-30 23:28:20 +0000.

Why default open in that case?


comment: 5
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27775#c5
Ryosuke Niwa wrote on 2015-01-30 23:47:07 +0000.

All the arguments I've heard for default open have been bogus at best. If authors can pierce through shadow boundaries, any hope for encapsulating your components' implementation details is lost.


comment: 6
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27775#c6
Hayato Ito wrote on 2015-02-06 01:40:36 +0000.

As I mentioned in comment #0, what 'default' should be orthogonal to the problem which this bug is trying to resolve.

Whatever the default would be, 'open' or 'closed, I don't see any effect of that on the behavior of closed shadow trees. Do you think the current behavior of UA shadow trees will be affected by the default? I don't think so.

I appreciate if you guys give us comments about the concrete behavior of closed shadow trees in this bug, if you have, as Philip did about '>>>'.

As for '>>>', yeah, I agree that '>>>' shouldn't piece closed shadow trees.


comment: 7
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27775#c7
Philip Jägenstedt wrote on 2015-02-10 04:41:55 +0000.

(In reply to Olli Pettay from comment #4)

Why default open in that case?

Hmm, I actually don't know, closed is probably a more sane default.


comment: 8
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27775#c8
Hayato Ito wrote on 2015-02-10 05:29:15 +0000.

Started to introduce an isolation mode, which is either 'open' or 'closed', at:

babf9a3


comment: 9
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27775#c9
Anne wrote on 2015-02-10 14:28:51 +0000.

Can we call this encapsulation mode and reserve the word isolation for a mode where not even globals are shared?


comment: 10
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27775#c10
Hayato Ito wrote on 2015-02-12 04:16:43 +0000.

(In reply to Anne from comment #9)

Can we call this encapsulation mode and reserve the word isolation for a
mode where not even globals are shared?

I think we can. Done at d0de816.


comment: 11
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27775#c11
Dylan Barrell wrote on 2015-03-10 21:44:16 +0000.

(In reply to Philip Jägenstedt from comment #3)

It would be nice to have closed shadow trees, which the the shadow-piercing
combinator '>>>' cannot reach into and whose internal structure is otherwise
entirely opaque to the containing document. Things like

We could perhaps also allow script-created shadow trees to be closed,
although defaulting to open.

I would strongly caution to not allow scripts to create closed trees from two perspectives:

  1. How do you do testing into a closed tree in an end-to-end testing environment like Webdriver? I have already encountered occasions where Angular 2 end-to-end testing is complicated by the shadow DOM. Making the shadow DOM totally opaque would further complicate this unless you provide a testing API - in which case what is to stop someone from mis-using the testing API to reach inside the shadow DOM.

  2. How do you do custom validations of entire documents for things like accessibility when the dependencies of ARIA roles and attributes can cross shadow root boundaries. One way to do this would be to expose the composed tree through an API but failure to expose the composed tree with the ability to create non-standard components that are 100% opaque make this sort of validation impossible.


comment: 12
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27775#c12
Dimitri Glazkov wrote on 2015-03-10 22:17:04 +0000.

(In reply to Dylan Barrell from comment #11)

(In reply to Philip Jägenstedt from comment #3)

It would be nice to have closed shadow trees, which the the shadow-piercing
combinator '>>>' cannot reach into and whose internal structure is otherwise
entirely opaque to the containing document. Things like

We could perhaps also allow script-created shadow trees to be closed,
although defaulting to open.

I would strongly caution to not allow scripts to create closed trees from
two perspectives:

  1. How do you do testing into a closed tree in an end-to-end testing
    environment like Webdriver? I have already encountered occasions where
    Angular 2 end-to-end testing is complicated by the shadow DOM. Making the
    shadow DOM totally opaque would further complicate this unless you provide a
    testing API - in which case what is to stop someone from mis-using the
    testing API to reach inside the shadow DOM.

  2. How do you do custom validations of entire documents for things like
    accessibility when the dependencies of ARIA roles and attributes can cross
    shadow root boundaries. One way to do this would be to expose the composed
    tree through an API but failure to expose the composed tree with the ability
    to create non-standard components that are 100% opaque make this sort of
    validation impossible.

This is one of the Closed-by-default Cons in the "contentious bits" document: https://github.com/w3c/webcomponents/wiki/Shadow-DOM:-Contentious-Bits#b-the-default-value-of-closed-shadow-tree-flag. If you have specific examples, please contribute them there.


comment: 13
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27775#c13
Hayato Ito wrote on 2015-04-23 16:06:46 +0000.

Status update about spec-ing the closed mode.

Mostly done about low-hanging fruits. However, there are still remaining tasks:

  1. event.path(): We should filter out a node in closed shadow tree.
    In addition to that, should we filter out a node in a open shadow tree if it is descendant tree of a closed tree?
    In general, we can't determine the open/closed-ness in the local context. We should consider the relationship between the current tree and the target tree, e.g There is a closed shadow tree in the middle.
  2. event retargeting
    Now we have a closed shadow tree. Should we continue an event retargeting even in for open shadow trees?
    How about opt-in?
  3. Other issues for mixing open/closed shadow trees.
    I guess no one has investigated how this mixture of open/closed should work seriously. We have to investigate further.

Anything else? If you notice something, please update this thread.


comment: 14
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27775#c14
Hayato Ito wrote on 2015-04-23 16:25:29 +0000.

Let me paste quote mail here, since it's related.

https://lists.w3.org/Archives/Public/public-webapps/2015AprJun/0225.html

D. Event Retargeting
1. We agree with making it optional (opt-in or opt-out). We don’t feel that strongly, but many web developers have asked for this. The default should likely match the default for open vs. closed (no retargeting by default if open by default). <https://www.w3.org/Bugs/Public/show_bug.cgi?id=28444 https://www.w3.org/Bugs/Public/show_bug.cgi?id=28444>


comment: 15
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27775#c15
Dylan Barrell wrote on 2015-04-23 17:40:45 +0000.

(In reply to Dimitri Glazkov from comment #12)

This is one of the Closed-by-default Cons in the "contentious bits"
document:
https://github.com/w3c/webcomponents/wiki/Shadow-DOM:-Contentious-Bits#b-the-
default-value-of-closed-shadow-tree-flag. If you have specific examples,
please contribute them there.

How do I comment in the wiki when I cannot edit it?


comment: 16
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27775#c16
Dimitri Glazkov wrote on 2015-04-23 19:03:52 +0000.

(In reply to Dylan Barrell from comment #15)

(In reply to Dimitri Glazkov from comment #12)

This is one of the Closed-by-default Cons in the "contentious bits"
document:
https://github.com/w3c/webcomponents/wiki/Shadow-DOM:-Contentious-Bits#b-the-
default-value-of-closed-shadow-tree-flag. If you have specific examples,
please contribute them there.

How do I comment in the wiki when I cannot edit it?

Doh. Good point. My apologies for directing you there. I will incorporate your feedback.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.