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

Bind event listeners to the shadow root if a component is being rendered into one #859

Closed

Conversation

wereHamster
Copy link

Related discussion is in #840.

* defined if it can actually run.
*/
var owningDocument = (function() {
if (typeof window != "undefined") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use ExecutionEnvironment.canUseDOM?

@wereHamster
Copy link
Author

@petehunt do have any further feedback on this change?

@carlmw
Copy link

carlmw commented Feb 3, 2014

Would love to see this land 👍

function putListener(id, registrationName, listener) {
var container = ReactMount.findReactContainerForID(id);
if (container) {
var doc = container.nodeType === ELEMENT_NODE_TYPE ?
container.ownerDocument :
owningDocument(container) :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's Element.shadowRoot per spec http://www.w3.org/TR/shadow-dom/#api-partial-element-shadow-root, can it be used instead?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately no. The shadowRoot property is the ShadowRoot that is being rendered inside of the element, not the one the element is inside of.

I'm not aware of any more efficient way to determine in which ShadowRoot (if any) a given element is. But I also haven't investigated deeply.

@petehunt
Copy link
Contributor

petehunt commented Feb 4, 2014

Now that shadow DOM is shipping in Chrome I think we should take this. @wereHamster have you run into any other issues with shadowdom + react?

@wereHamster
Copy link
Author

I ported my whole codebase to react only and am not using Polymer anymore. So I can't comment on any issues.

@zpao
Copy link
Member

zpao commented Jun 24, 2014

@wereHamster I know you said you weren't using Polymer anymore, but if you have a simple example that should work but was broken, that would be helpful for somebody who might be interested in picking it up.

In the meantime, I think I'll close this out since we dropped the ball (sorry!). If you're interested in picking it back up, just reopen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants