From db6c74a232587ea81a70d9a2ed768a1d92189369 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Mon, 18 Jul 2016 11:00:46 +0100 Subject: [PATCH] Limit image search to content firing event Bug: T140574 Change-Id: I3c504c09b2b382e094ab2be1fa388efa7ec827b1 --- resources/mmv/mmv.bootstrap.js | 4 ++-- tests/qunit/mmv/mmv.bootstrap.test.js | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/resources/mmv/mmv.bootstrap.js b/resources/mmv/mmv.bootstrap.js index 870033021..18bec3d92 100644 --- a/resources/mmv/mmv.bootstrap.js +++ b/resources/mmv/mmv.bootstrap.js @@ -129,10 +129,10 @@ /** * Processes all thumbs found on the page */ - MMVB.processThumbs = function () { + MMVB.processThumbs = function ( $content ) { var bs = this; - this.$thumbs = $( + this.$thumbs = $content.find( '.gallery .image img, ' + 'a.image img, ' + '#file a img, ' + diff --git a/tests/qunit/mmv/mmv.bootstrap.test.js b/tests/qunit/mmv/mmv.bootstrap.test.js index 585ba6ab9..6d0d6270c 100644 --- a/tests/qunit/mmv/mmv.bootstrap.test.js +++ b/tests/qunit/mmv/mmv.bootstrap.test.js @@ -52,6 +52,8 @@ function createBootstrap( viewer ) { var bootstrap = new mw.mmv.MultimediaViewerBootstrap(); + bootstrap.processThumbs( $( '#qunit-fixture' ) ); + // MultimediaViewerBootstrap.ensureEventHandlersAreSetUp() is a weird workaround for gadget bugs. // MediaViewer should work without it, and so should the tests. bootstrap.ensureEventHandlersAreSetUp = $.noop;