在Safari 8上间接调用addEventListener会产生TypeError

时间:2015-07-15 13:42:38

标签: javascript safari addeventlistener

我遇到了以下示例所示的特定于Safari的错误。

var el = document.getElementById("foo");

// This works as expected
el.addEventListener('click', handler);

// This should be equivalent to the above, but it doesn't work.
var alias = addEventListener;
alias.call(el, 'click', handler);

以下是适用于Chrome和Firefox的jsFiddle,但在Safari(8.0.7)上会产生TypeError

知道为什么吗?

0 个答案:

没有答案