MozTW 討論區 https://forum.moztw.org/ |
|
擴展開發請教:如何避免使用“eval”? https://forum.moztw.org/viewtopic.php?f=18&t=35221 |
第 1 頁 (共 1 頁) |
發表人: | idragonet3 [ 2012-05-21, 17:04 ] |
文章主題 : | 擴展開發請教:如何避免使用“eval”? |
引言回覆: Your add-on still uses the 'eval' function unnecessarily, which is something we normally don't accept. AMO:Editors/EditorGuide/AddonReviews https://wiki.mozilla.org/AMO:Editors/Ed ... donReviews Easy DragToGo+ easydragtogo.js代码段: 主要是下面这段(功能:使用自定义代码)使用了eval: 引言回覆: customCode: function(code, url, src, target, X, Y) { eval(code); }, 改為這樣的無法通過,那位大俠知道該如果修改嗎? 引言回覆: customCode: function (code, url, src, target, X, Y) { var customFn = new Function("target", "url", "src", "X", "Y", code); customFn(target, url, src, X, Y); }, |
發表人: | Irvin [ 2012-05-21, 21:57 ] |
文章主題 : | Re: 擴展開發請教:如何避免使用“eval”? |
eval 的 MDN 頁面最下面列了幾種替代的方法,可以試試 |
第 1 頁 (共 1 頁) | 所有顯示的時間為 UTC + 8 小時 |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |