Unexpected selector results with FireFox beta

Showing 1-7 of 7 messages
Unexpected selector results with FireFox beta Axllent 12/10/12 3:50 PM
Hi all,

Please forgive me if this issue has been noted before (I couldn't find it), however I noticed some strange behaviour resulting from Firefox beta and the $$ selector (using class names) using MooTools 1.2.5. I do realise that 1.2.5 is old, however we have several sites using it, and this issue seems to be something that could affect several of them. I was hoping to find the answer/solution before having to start rewriting stuff :)

Problem:
It would seem that something like $$('div.find') also finds partial matches for elements eg: <div class="finds">, or <div class="donotfindme"> when using 1.2.5 and the beta version of FireFox.

I have an example on jsfiddle.net/wZsax/ - all other browsers seem fine and find just the first element, however FF beta finds both.

I realise that this does not happen in later versions of MooTools, nor with the stable version of Firefox (v17), however should the beta become stable (assuming no change to the JS engine affecting this), then this could become a bigger problem.

Could anyone point out whether this is a bug in MooTools 1.2.5, and if so whether there could be a fix at the core-level?

Many thanks & kind regards,
Ralph
Re: [Moo] Unexpected selector results with FireFox beta Arian Stolwijk 12/10/12 3:55 PM
I think this relates to https://github.com/mootools/mootools-core/issues/2402

Could you add this somewhere, probably before adding MooTools to the page.

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

We probably need to fix this as a 1.2.6.
Re: [Moo] Unexpected selector results with FireFox beta Axllent 12/10/12 4:45 PM
Hi Arian,

Thanks for your quick response! Yes, this fixes the problem, even if it's added after the MooTools core (but before the script itself): http://jsfiddle.net/wZsax/1/

Thanks again,
Ralph
Re: [Moo] Unexpected selector results with FireFox beta Arian Stolwijk 1/14/13 4:45 PM
Even a simpler solution is:

Before you load MooTools, do:

delete String.prototype.contains;


Re: [Moo] Unexpected selector results with FireFox beta Arian Stolwijk 1/14/13 4:46 PM
Re: [Moo] Unexpected selector results with FireFox beta Arian Stolwijk 2/19/13 9:14 AM
Re: [Moo] Unexpected selector results with FireFox beta Axllent 2/20/13 9:58 AM

Excellent! Thanks for the follow-up.

Regards,
Ralph

--
 
---
You received this message because you are subscribed to the Google Groups "MooTools Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mootools-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.