我在自定义元素中的一个div上添加了一个tap监听器,使用代码如下:
你有什么想法吗?
var nicediv = document.getElementById('nicediv');
nicediv.addEventListener('tap',this.listenerfunc.bind(this),false);
这个操作是成功的,但我无法移除事件监听器。这种方法不起作用。
nicediv.removeEventListener('tap',this.listenerfunc);
你有什么想法吗?
function removeEventListener() { [native code] }
。但是detachEvent未定义。所以我使用的方法是正确的。在最新版本的Chrome中,removeEventListener中useCapture的false值应该是默认为false的。但无论如何,我也尝试过了。不起作用。这一定与Polymer相关。 - Aravind