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!


Sharing is Caring

To avoid spam, please login to leave a comment.

Recommend this Article

Latest Comments

  • Introducing SIMAnswers with EasySocial

    redioktarizal 06.09.2014 15:43
    I am interested in your product, hopefully this can help me in the world of online marketing ( ...
     
  • 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.