Ember FireFox 中未触发操作

Ember action not triggered in FireFox

这个 twiddle 在 Chrome 中工作但在 firefox 中不工作

https://ember-twiddle.com/aa8196622fcd6b8f6ce441c8a9174600?openFiles=controllers.application.js%2C

我发现了类似的问题 here,但没有理由不工作。

我正在使用 Firefox v61.0.1 和 Chrome v67.0.3396.99

 //application.hbs

 <div class="box">
 <button type="button" class="close note-close" aria-label="Close">
 <span aria-hidden="true" class="close" {{action 'testAction'}}>&times;</span>
 </button>
 </div>


//application.js

import Ember from 'ember';

export default Ember.Controller.extend({
  appName: 'Ember Twiddle',
  actions: {
    testAction: function() {
      alert("Close Button Working");
    }
  }
});

如果点击Chrome中的关闭按钮,会触发controller中的testAction。但在 firefox 中没有错误,但没有在控制器中触发我的 testAction。

单击按钮元素的嵌套元素不起作用。

将您的操作添加到按钮元素并使用 (onclick)

<button type="button" class="close note-close" aria-label="Close" onclick={{action 'testAction'}}>
  <span aria-hidden="true" class="close note-close">&times;</span>
</button>