Firefox 18 breaks mootools 1.2.5 selector engine

匆匆过客 提交于 2019-12-05 08:05:54

I've found the answer here: https://groups.google.com/forum/#!msg/mootools-users/W7MHwTFHYQ4/B4HcR951XQYJ

Add the following code anywhere in javascript - I added it just above mootools, and it works perfectly:

String.prototype.contains = function(string, separator){
    return (separator) ? (separator + this + separator).indexOf(separator + string + separator) > -1 : String(this).indexOf(string) > -1;
};

known bug. If I remember correctly, it's to do with the early introduction of the proposed ES harmony String.prototype.contains in Gecko, which has a different 2-nd argument to the one in 1.2.5

a quick workaround is to say do, delete Sting.prototype.contains before you load MooTools so it redefines it. Since 1.3, this has stopped being a protected prototype method and has been redefined properly. I think there may have been a bug raised on the repo by one of the FireFox guys some 6 months ago as it was imminently landing in FF 17...

See this: https://bugzilla.mozilla.org/show_bug.cgi?id=789036#c23

Even Brendan Eich was commenting on this and suggesting it may be disabled in 18.0.1 as it was adopted prematurely.

More background information on this: MooTools 1.2.x was broken by adding String.prototype.contains

The solution is to use the workaround from the other comment or upgrade to MooTools 1.3 or 1.4

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!