RCFilters: restore watch/unwatch link
authorStephane Bisson <sbisson@wikimedia.org>
Fri, 22 Sep 2017 10:35:58 +0000 (06:35 -0400)
committerStephane Bisson <sbisson@wikimedia.org>
Fri, 22 Sep 2017 10:35:58 +0000 (06:35 -0400)
Use jQuery event delegation to handle all
present and future watch/unwatch links.

Bug: T176264
Change-Id: If372c480e3e3809485027744b99caa6d4c94f86a

resources/src/mediawiki.special/mediawiki.special.watchlist.js

index 535ca93..4319be7 100644 (file)
@@ -59,7 +59,7 @@
                        // If a page is on the watchlist, a '×' is shown which, when clicked, removes the page from the watchlist.
                        // After unwatching a page, the '×' becomes a '+', which if clicked re-watches the page.
                        // Unwatched page entries are struck through and have lowered opacity.
-                       $( '.mw-unwatch-link, .mw-watch-link' ).click( function ( event ) {
+                       $( '.mw-changeslist' ).on( 'click', '.mw-unwatch-link, .mw-watch-link', function ( event ) {
                                var $unwatchLink = $( this ), // EnhancedChangesList uses <table> for each row, while OldChangesList uses <li> for each row
                                        $watchlistLine = $unwatchLink.closest( 'li, table' )
                                                .find( '[data-target-page]' ),