Firefox 18打破了mootools 1.2.5选择器引擎 [英] Firefox 18 breaks mootools 1.2.5 selector engine
问题描述
这个问题只发生在我知道的Firefox 18中。
以下html:
< div class =test> Test Div< / div>
< div class =testIgnore>这应该保持不变< / div>
用这个js:
window.addEvent('domready',function(){
$$('。test')。set('html','Only Test should update');
});
结果如下:
只有测试应该更新
只有测试应该更新
升级到Mootools 1.4.5目前不是一个选项,因为大量的插件使用1.2.5,任何人都可以在正确的方向指向我得到一个修复?
我在这里找到了答案: https://groups.google.com/forum/#!msg/mootools-users/W7MHwTFHYQ4/B4HcR951XQYJ
在javascript中的任意位置添加以下代码 - 我将它添加到了mootools之上,它完美地工作:
$ b $ pre $ String $原型.contains =函数(字符串,分隔符){
返回(分隔符)? (分隔符+这个+分隔符).indexOf(分隔符+字符串+分隔符)> -1:String(this).indexOf(string)> -1;
};
Working jsfiddle example here: http://jsfiddle.net/CfJyd/
The problem only occurs in Firefox 18 that I know of.
The following html:
<div class="test">Test Div</div>
<div class="testIgnore">This should stay the same</div>
With this js:
window.addEvent('domready',function() {
$$('.test').set('html','Only Test should update');
});
Results in this output:
Only Test should update
Only Test should update
Upgrading to Mootools 1.4.5 isn't an option at the moment because of lots of plugins that use 1.2.5, can anybody point me in the right direction on getting a fix?
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;
};
这篇关于Firefox 18打破了mootools 1.2.5选择器引擎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!