Codepen.io中使用的CoffeeScript不再适用于Internet Explorer

时间:2018-05-12 20:16:51

标签: javascript internet-explorer coffeescript codepen

我在过去几年中在Codepen.io上创建了很多代码示例。我使用的是CoffeeScript而不是JavaScript,这些示例通常适用于Firefox,Chrome和Internet Explorer。

几个星期前,我在Internet Explorer中再次检查过,但它们似乎不再起作用了。

看一下这个例子:https://codepen.io/accessibility-developer-guide/pen/BxxrBj

在Internet Explorer中,控制台显示“语法错误”:

错误的代码是:

我在那里看到了=>,这似乎是一个问题。但在其他浏览器中,这似乎有效。

原始代码没什么特别的:

$(document).ready ->
  $button = $("button")
  $tooltip = $("#tooltip")

  $button.click =>
    if $tooltip.attr("hidden") == "hidden"
      $tooltip.removeAttr("hidden")
      $button.attr("aria-expanded", true)
    else
      $tooltip.attr("hidden", true)
      $button.attr("aria-expanded", false)

最近有没有对Codepen.io编译其CoffeeScript的方式有任何改变?也许是因为Internet Explorer不再支持的JavaScript版本了?

有没有办法将其更改回兼容版本?

0 个答案:

没有答案