dart-archive / polymer-dart

Polymer support for Dart
https://pub.dartlang.org/packages/polymer
BSD 3-Clause "New" or "Revised" License
181 stars 33 forks source link

DomRepeatModel.fromEvent returns null item when event fired from element inside 'dom-if' template #692

Closed kv1122 closed 8 years ago

kv1122 commented 8 years ago

I have a 'dom-repeat' template looping over a conditional 'dom-if' template.

<template is="dom-repeat" items="{{members}}" as="person">
  <div class="row">
     <div class="cell"><a on-tap="removeMemberButtonTapped" href="#">{{person.title}} {{person.first_name}} {{person.last_name}}</a></div>
     <template is="dom-if" if="{{!readonly}}" restamp>
          <div class="cell">
              <paper-icon-button on-tap="removeMemberButtonTapped" id="removeMemberButton" title="Remove member" style="color: red;" icon="icons:clear"></paper-icon-button>
          </div>
      </template>
   </div>
</template>

In the dart code member is null when the paper-button is tapped but the valid object when the <a> link is tapped.

@reflectable
  void removeMemberButtonTapped(Event event, Map detail) {
    if (!removeMemberDialog.opened) {
      var member = new DomRepeatModel.fromEvent(event).item;
      print(member);
      set("contextMember", member);
      removeMemberDialog.open();
    }
  }

Dart sdk: 1.16.0-dev-1.0 Dependencies: pubspec.lock attached pubspec.zip

zoechi commented 8 years ago

Looks like Polymer/polymer#2574, Polymer/polymer#1919

kv1122 commented 8 years ago

Yup, dup of #2574, possibly #1919 too.

zoechi commented 8 years ago

I guess you can close it here. When it's fixed in JS it will be fixed in Dart with the next roll anyway. No need to track it here as well.

kv1122 commented 8 years ago

Done