Skip to content
This repository

custom events don't work #242

Closed
jmesserly opened this Issue December 05, 2012 · 3 comments

3 participants

John Messerly Jonas sigmundch
John Messerly
Collaborator

We don't allow "on-" to work with custom event names, as far as I can tell.

Jonas
Sanjo commented May 30, 2013

+1

The code generator must generate on['eventName'] instead of onEventName for custom events. Like:

__t.listen(__e1.on['eventName'], ($event) { print('The event "eventName" triggered.'); });

I could try to implement this.

sigmundch
Collaborator

Hi @sanjo, thanks for the pull request! we'll take a look shortly.

I should clarify that one challenge here is that we should use 'onClick' instead of on["click"] whenever that's possible. In particular, dart:html has polyfills for various events that only work if you use the former syntax. For example onMouseWheel and onTransitionEnd won't work using the '[]' notation.

Another challenge in the case of custom events and components is that we might have to do something different if you are attaching an event directly to a custom element or a parent. If you attach it to a parent (you want to use bubbling or capture of events) then we need the on["click"] syntax, but if we attach it directly to the custom-element, we probably want to call onClick stream directly on the element (or the .xtag of the host element)

John Messerly
Collaborator

fixed in polymer

John Messerly jmesserly closed this November 07, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.