bnavetta / aurelia-polymer

Aurelia plugin to support Polymer
MIT License
18 stars 5 forks source link

event delegation not working #13

Open ghost opened 8 years ago

ghost commented 8 years ago

Hi,

I'm having some trouble with event delegation. In this case, with the on-content-scroll event of paper-header-panel.

As it is specified in the component documentation: <paper-header-panel on-content-scroll="scrollHandler">...</paper-header-panel> But the event is not triggering. Seems like the customAttribute feature of Aurelia is overwriting it...

Any clue?

bnavetta commented 8 years ago

Instead of using on-content-scroll, you can use Aurelia's content-scroll.trigger="scrollHandler($event)". In theory, .delegate should work as well, but I've been having some issues with it.

ghost commented 8 years ago

Thanks! I'll give it a try.

ghost commented 8 years ago

I've tried scroll.trigger and scroll.delegate and it is not working...

It is the same behavior when I'm trying to intercept a change in a paper-input with on-change="changeDetected" or change.delegate="changeDetected()".

bnavetta commented 8 years ago

I just had it working with content-scroll.delegate. What version of Aurelia are you using?

<paper-scroll-header-panel class="flex" content-scroll.delegate="headerScroll($event)">
    <paper-toolbar>
      <div>Hello, World!</div>
    </paper-toolbar>
    <div class="content" innerhtml.bind="text">
    </div>
  </paper-scroll-header-panel>

As for the paper-input, I'm not sure where this is actually documented, but it looks like the event name is input now, so input.delegate ought to work.

bnavetta commented 8 years ago

For change in particular, there might be something about the shadow DOM spec that Polymer is accounting for.