I recently have discovered a warning happening in Firefox that says
Warning: Unknown pseudo-class or pseudo-element ‘hidden’
Here is page http://eleven23.net/eleven23/beta/work/web/lounge22.php
And the warning happens when it gets to the part of javascript that has img:hidden
$(‘img:hidden’).eq(0).fadeIn(500);//fades in the hidden images one by one
i++;//add 1 to the count
So Im wondering if anyone has an idea on how to resolve this warning.
Thanks!
The first step is to really stop the repeated calling of
doThis()viasetIntervalwhich at the moment doesn’t happen. Thus the warning appears every 500ms.Change
to
Else your call to
clearInterval(int)won’t do anything as you declaredvar inttwice and try to clear the “outer” int which isn’t the interval.After this fix only 4-5 of this warning should remain in your console.
Now to your error. There isn’t much you can do to stop this error from appearing exactly that many times you call
doThis().jQuery uses Sizzle internally as selector engine. And in some cases Sizzle tries to use (on browsers supported) the
querySelectorAll()function to find the elements matching your selector.Now AFAIK is
hiddennot a valid CSS selector thus although Firefox supports the call toquerySelectorAll()it correctly fails after encountering an unknown selector. jQuery catches the error and then does the selection ofimage:hiddenitself.If you don’t want to see this error at all you can use a different jQuery syntax which in this case would stop Sizzle from trying to attempt to use
querySelectorAll().Change
to
But I don’t advise you to do this as it doesn’t really get you much only 4-5 warnings less in your console.