Register Forgot your password? Forgot your username?

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