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

  • Introducing the new SIMGallery 4.1

    Mike Feng 17.05.2014 07:47
    Thanks! If you have a minute, please consider leaving a review at SIMGallery's JED page at ...
     
  • Introducing the new SIMGallery 4.1

    Ray Field 17.05.2014 07:36
    I love SIM gallery. I find it the best tool for sorting my pictures, in such innovative different ...
     
  • 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 ...