Skip to content
This repository has been archived by the owner on Aug 5, 2019. It is now read-only.

Why use Event.sinkEvents+Event.setEventListener rather than element.addEventListener? #6

Open
tbroyer opened this issue Aug 6, 2016 · 3 comments

Comments

@tbroyer
Copy link

tbroyer commented Aug 6, 2016

Even weirder that addEventListener is actually used in the nav list detail archetype for the submenus, mixed with Event.sinkEvents and Event.setEventListener for top menu items.

@zak905
Copy link
Member

zak905 commented Aug 6, 2016

The reason for that is because top menu items are of type com.google.gwt.dom.client.AnchorElement, so they have no such method as addEventListener. The submenus are of type com.vaadin.polymer.paper.PaperItemElement which happen to have addEventListener.

is there a better solution?

@tbroyer
Copy link
Author

tbroyer commented Aug 6, 2016

Use an Anchor widget? .cast() the AnchorElement into a Vaadin EventTarget? Use a Vaadin element or EventTarget as the @UiField?

@zak905
Copy link
Member

zak905 commented Aug 7, 2016

I am going to give it a try. Are there any recommendations against using Event.setEventListener ?

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

No branches or pull requests

2 participants