我遇到了以下示例所示的特定于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
。
知道为什么吗?