Upstream `isElementInViewport` from MobileFrontend
authorjhobs <jhobson@wikimedia.org>
Thu, 28 Jan 2016 17:49:38 +0000 (12:49 -0500)
committerjdlrobson <jdlrobson@gmail.com>
Wed, 2 Mar 2016 22:22:14 +0000 (14:22 -0800)
commit3f4e016873da100a002d60e2de38ae5d167b4981
tree8fd573960148f6280f1594ccd08f1221630af7df
parent2752ce2b6b5807766e58d8493db4286a8e88235d
Upstream `isElementInViewport` from MobileFrontend

As a useful utility function, we've copied this method several times
across multiple extensions, which is a pretty good sign it should
actually live in core.

Changes:
 * Add `mediawiki.viewport` module
 * Rewrite method to be more robust and accept any viewport
 * Add `mw.viewport` to jsduck categories file
 * Add method for checking if an element is close to the viewport
 * Add unit tests

Bug: T124317
Change-Id: I38eec4f1e568f51e7e212b2b3f10b8da8d36f316
maintenance/jsduck/categories.json
resources/Resources.php
resources/src/mediawiki/mediawiki.viewport.js [new file with mode: 0644]
tests/qunit/QUnitTestResources.php
tests/qunit/suites/resources/mediawiki/mediawiki.viewport.test.js [new file with mode: 0644]