gpt4 book ai didi

jquery - 为什么要写 `window[ "eval"].call( window, data );`

转载 作者:行者123 更新时间:2023-12-03 22:26:41 25 4
gpt4 key购买 nike

jQuery 1.7rc1 第 614 行:

window[ "eval"].call( window, data );

为什么不直接写

eval.call( 窗口, 数据 );?

最佳答案

答案在这里:Decoding jQuery ,

Jim Driscoll found out that for more standards-respecting browsers, you could use eval.call(window,data), but for Chrome and IE, things are a bit different.

Internet Explorer: It seems that IE uses window.execScript(data)

Chrome: eval.call(window,data) breaks on Chrome, but window[ "eval" ].call( window, data) works on Chrome, and as well as other non-IE browsers, this is how the above workarounds based upon.

关于jquery - 为什么要写 `window[ "eval"].call( window, data );`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7922073/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com