Problem with Mootools Selector with the new Firefox

This is something I found out recently, and may be of interest to other developers.

Consider this HTML code:

<div id="mydiv">
     <div class="slab-wrapper">
         <div class="slab">
         </div>
     </div>
</div>

 

Consider this Mootools 1.24 javascript snippet:

$('mydiv').getElement('div.slab');

 

Now you would expect <div class="slab"> to be selected, and you'd be right for Chrome, IE and other browsers, but Firefox throws a wrench in by apparently selecting the first element with a class with the word "slab" in it (in this case <div class="slab-wrapper">)


The workaround will be to use:

$('mydiv').getElement('div[class=slab]');

 

Good luck!

To avoid spam, please login to leave a comment.

Latest Comments

  • ParaInvite 3.5 is here!

    yann anderson 08.09.2012 12:08
    just installed your product parainvite, with joomla 2.5 and jomsocial 2.6.2 --> very easy to use, and ...
     
  • ParaInvite 3.5 is here!

    Mike Feng 07.09.2012 05:12
    Yes, it works with the latest JomSocial version.
     
  • ParaInvite 3.5 is here!

    Guest 05.09.2012 16:50
    Hi, allready running with jomsocial 2.6.2 ? Jomsocial added recents patch (2.6.1//2.6.2) and before to ...
     
  • ParaInvite 3.5 is here!

    Mike Feng 05.06.2012 13:29
    Yes, we made it compatible.
     
  • ParaInvite 3.5 is here!

    Guest 01.06.2012 18:44
    Mike how does it work with openinvite when there is no compatible openinvite available for joomla 1.6 ...