Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

g-component custom events can be handled in wrong scope #30

Closed
sorvell opened this issue Oct 31, 2012 · 4 comments
Closed

g-component custom events can be handled in wrong scope #30

sorvell opened this issue Oct 31, 2012 · 4 comments
Assignees
Labels

Comments

@sorvell
Copy link
Contributor

sorvell commented Oct 31, 2012

Placing on-eventName="eventNameHandler" on an element in a shadowRoot should call an eventNameHandler method on the host node. This does not occur if the element on which the on- attribute occurs is itself inside a custom component, e.g.

<template>
  <g-foo>
    <button on-click="clickHandler">

...

@ghost ghost assigned sjmiles Oct 31, 2012
@sjmiles
Copy link
Contributor

sjmiles commented Nov 5, 2012

Fixed by a88671e

@sjmiles sjmiles closed this as completed Nov 5, 2012
@frankiefu
Copy link
Member

The issue is still happening in shim ShadowDOM.

@frankiefu frankiefu reopened this Nov 26, 2012
@sjmiles
Copy link
Contributor

sjmiles commented Nov 29, 2012

Steve made issues/pending/shimShadowComponentEvents test case.

@sjmiles
Copy link
Contributor

sjmiles commented Nov 29, 2012

The problem arises because we are trying to walk into the shadow DOM from composed DOM.

Natively, a node exists only in one local DOM and the composed DOM is virtual (and can be ignored). Shim requires that a node exists only in composed DOM, so placeholders are used for other trees (Changelings).

Naively, node.changeling is used to locate the shadow DOM subtree where node is intended to exist. Unfortunately, multiple placeholders are used to implement projections and compositions, so node.changeling often refers to the wrong subtree.

I've attempted to solve this problem by:

(1) making sure that node.changeling is only set once (i.e. cache the initial position only)
(2) setting lightDOM.host
(3) coding the controller tree climber to use lightDOM.host as if it were parentNode

I may have missed a wrinkle, or there could be negative side-effects, which is why I wanted to document it here.

sorvell pushed a commit that referenced this issue Nov 30, 2012
fixes issue #30: allow findController to step out of lightDOM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants