({
photo: foo.addEventListener("animationend", photoCycle, true) || foo.addEventListener("webkitAnimationEnd", photoCycle, true),
bio: foo.addEventListener("animationend", bioCycle, true) || foo.addEventListener("webkitAnimationEnd", bioCycle, true)
})[mode]
我正在尝试创建一个对象来评估模式(它将是字符串photo或bio)并根据它是 firefoxanimationend还是 chrome添加事件侦听器webkitanimationend。奇怪的是,当模式是photo我得到bio键的无效标签的语法错误。