Search code examples
mootools

mootools equivalent of jQuery's .is()


Does Mootools have the equivalent of jQuery's .is()? Or if not, what's the best approach for this functionality in Mootools? I've searched for a while and can't seem to find the right solution.

Example of jQuery I'm trying to achieve in Mootools.

if(a.is(':last-child')){
   console.log('this should return true >', a.is(':last-child'));
}

Any help would be great, thanks!


Solution

  • Well I don't know of a Mootools equivalent, but you can probably the native matches() function. Other Link

    var bd = document.body;
    console.log(bd.matches('body')) //true
    console.log(bd.matches(':last-child')) //true