diff options
author | James D. Forrester <jforrester@wikimedia.org> | 2014-10-15 15:39:38 -0700 |
---|---|---|
committer | James D. Forrester <jforrester@wikimedia.org> | 2014-10-15 15:39:38 -0700 |
commit | b7551623ef67e9eb51033943a2f8b8c581024acc (patch) | |
tree | 6b18cd87d2b6ea1001c0af0ef6a767b72d0cb809 /resources/lib/oojs-ui/oojs-ui.js | |
parent | 317345b0df82461cae98b72643a5443932117a86 (diff) | |
download | mediawikicore-b7551623ef67e9eb51033943a2f8b8c581024acc.tar.gz mediawikicore-b7551623ef67e9eb51033943a2f8b8c581024acc.zip |
Update OOjs UI to v0.1.0-pre (98cecf304d)
New changes:
98cecf3 Support MenuWidget's config.widget being in a different document
Change-Id: Ifc30790e67926bbdda0a8d5ec9464e7046f984ea
Diffstat (limited to 'resources/lib/oojs-ui/oojs-ui.js')
-rw-r--r-- | resources/lib/oojs-ui/oojs-ui.js | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/resources/lib/oojs-ui/oojs-ui.js b/resources/lib/oojs-ui/oojs-ui.js index 50f69f3f5f34..925585c5f290 100644 --- a/resources/lib/oojs-ui/oojs-ui.js +++ b/resources/lib/oojs-ui/oojs-ui.js @@ -1,12 +1,12 @@ /*! - * OOjs UI v0.1.0-pre (d74a46ca6a) + * OOjs UI v0.1.0-pre (98cecf304d) * https://www.mediawiki.org/wiki/OOjs_UI * * Copyright 2011–2014 OOjs Team and other contributors. * Released under the MIT license * http://oojs.mit-license.org * - * Date: 2014-10-15T00:40:17Z + * Date: 2014-10-15T22:39:24Z */ ( function ( OO ) { @@ -11181,7 +11181,9 @@ OO.ui.MenuWidget.prototype.toggle = function ( visible ) { visible = ( visible === undefined ? !this.visible : !!visible ) && !!this.items.length; var i, len, - change = visible !== this.isVisible(); + change = visible !== this.isVisible(), + elementDoc = this.getElementDocument(), + widgetDoc = this.$widget ? this.$widget[0].ownerDocument : null; // Parent method OO.ui.MenuWidget.super.prototype.toggle.call( this, visible ); @@ -11205,9 +11207,15 @@ OO.ui.MenuWidget.prototype.toggle = function ( visible ) { // Auto-hide if ( this.autoHide ) { - this.getElementDocument().addEventListener( + elementDoc.addEventListener( 'mousedown', this.onDocumentMouseDownHandler, true ); + // Support $widget being in a different document + if ( widgetDoc && widgetDoc !== elementDoc ) { + widgetDoc.addEventListener( + 'mousedown', this.onDocumentMouseDownHandler, true + ); + } } } else { this.unbindKeyDownListener(); @@ -11215,9 +11223,15 @@ OO.ui.MenuWidget.prototype.toggle = function ( visible ) { this.$previousFocus[0].focus(); this.$previousFocus = null; } - this.getElementDocument().removeEventListener( + elementDoc.removeEventListener( 'mousedown', this.onDocumentMouseDownHandler, true ); + // Support $widget being in a different document + if ( widgetDoc && widgetDoc !== elementDoc ) { + widgetDoc.removeEventListener( + 'mousedown', this.onDocumentMouseDownHandler, true + ); + } this.toggleClipping( false ); } } |