Search code examples
firefoxmootools

Firefox 18 breaks mootools 1.2.5 selector engine


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?


Solution

  • 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;
    };