[Bug 21067] [Shadow]: Provide an api to insertionParent

https://www.w3.org/Bugs/Public/show_bug.cgi?id=21067

--- Comment #22 from Hayato Ito <hayato@chromium.org> ---
(In reply to comment #21)
> I prefer composedParent over renderParent; however, I am wondering about the
> alternative of simply changing insertionParent to insertionPath. In this
> case, insertionPath would be the list of insertion points to which a node
> was distributed. Given this, I believe the full event.path could be
> constructed. Hayato-san, I respect your knowledge of this topic, do you
> agree about this?

Agreed. If we can return the list of insertion points, we can construct full
event.path in theory.

At the same time, I'm afraid that might require some amount of code in the
consumer side.
Let me emulate eventPath using insertionPath():

This is a pseudo code.

function eventPath(node) {
  if (!node)
     return [];
  var insertionPoints = node.insertionPath();
  if (insertionPoints.isEmpty) {
    if (node.isShadowRoot)
      if (node.toShadowRoot.isYoungestShadowRoot)
        return [node] ++ eventPath(node.shadowHost);
      else
        return [node];
    else
      return [node] ++ eventPath(node.parentNode));
  else {
    return [node] ++ insertionPoints ++
eventPath(insertionPoints.last.parentNode);
  }
}

... and I am now feeling there might be a bug in this eventPath function. I'm
not sure. :)
The point is that it might not be easy to emulate eventPath in the client side.


> 
> While the event path tree is not necessary for the use cases in this thread,
> I'm not sure it's never necessary, and it seems odd to have event.path and
> traversal via 'composedParent' produce a different tree. I'd rather err on
> the side of providing more information.

Thank you for the info. I appreciate that. Let's continue discussion and
iterate cycle until we have a good spec.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Thursday, 23 May 2013 04:49:10 UTC