Use :not() CSS pseudo-class instead of jQuery .not() filter in selector

The old version would iterate over all links on the page (try that on
[[Barack Obama]]), the new one should be optimized by the browser and
poly-filled by jQuery if unavailable.

We can't do `:not(.extiw, .image, .new, .internal, [title=""])` –
while some browsers support it, CSS specification doesn't allow
compount selectors inside :not().

Change-Id: I0e4b18752905604ebf1b7f41a9b7ac2edd8b42e0
This commit is contained in:
Bartosz Dziewoński 2014-04-22 15:55:43 +02:00 committed by Yuvipanda
parent 31e42fd85a
commit c3e3df7905

View file

@ -428,12 +428,7 @@
// Remove title attribute to remove the default yellow tooltip
// Put the title back after the hover
$( '#mw-content-text a' )
.not( '.extiw' )
.not( '.image' )
.not( '.new' )
.not( '.internal' )
.not( '[title=""]' )
$( '#mw-content-text a:not(.extiw):not(.image):not(.new):not(.internal):not([title=""])' )
.on( 'mouseenter focus', function () {
$( this )
.attr( 'data-original-title', $( this ).attr( 'title' ) )