jQuery 1.8: unsupported pseudo: hover

Unfortunately, while we all wish that our code were future proof, your $('foo').on( 'hover, ... function(){ //do stuff } code is deprecated in jQuery 1.8. I wish I had better news for you, but your code is broken because of a core change to jQuery 1.8. You now have to use the syntax

$('.selector').on( 'mouseenter mouseleave', function() {
      $(this).toggleClass('hover');
   }
);

if(!$(this).parent().find('ul').first().hasClass('hover')) {
   $(this).parent().parent().removeClass('open');
}

Wish I had better news for you, but deprecation happens :/ … jQuery 1.8 doesn’t like your shortcut and they’ve deprecated the hover event handler from .on() and also the pseudo-selector :hover, so it can’t be used that way any more.

Leave a Comment