From faba9bc36dd35a75d4b0d7c5c7d325be613cf608 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thiemo=20M=C3=A4ttig?= Date: Thu, 25 Feb 2016 14:34:01 +0100 Subject: [PATCH] OOjs UI: Fix #gatherPreInfuseState called incorrectly, causing TypeErrors This bug is currently live. Try opening https://www.wikidata.org/wiki/Special:NewItem and have a look at the JavaScript console. Introduced in If07d40a. This patch is a manual cherry-pick from I748a4bc, which is the same fix in the original repository. I feel we should backport this to production. Bug: T106313 Bug: T128075 Change-Id: I25a5deab2c287e97086726d0acbb3afeee842e0b --- resources/lib/oojs-ui/oojs-ui-core.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/lib/oojs-ui/oojs-ui-core.js b/resources/lib/oojs-ui/oojs-ui-core.js index e244037302..67d3c02c6f 100644 --- a/resources/lib/oojs-ui/oojs-ui-core.js +++ b/resources/lib/oojs-ui/oojs-ui-core.js @@ -610,13 +610,13 @@ OO.ui.Element.static.unsafeInfuse = function ( idOrNode, domPromise ) { } if ( domPromise ) { // pick up dynamic state, like focus, value of form inputs, scroll position, etc. - state = data.gatherPreInfuseState( $elem ); + state = data.constructor.static.gatherPreInfuseState( $elem, data ); // restore dynamic state after the new element is re-inserted into DOM under infused parent domPromise.done( data.restorePreInfuseState.bind( data, state ) ); infusedChildren = $elem.data( 'ooui-infused-children' ); if ( infusedChildren && infusedChildren.length ) { infusedChildren.forEach( function ( data ) { - var state = data.gatherPreInfuseState( $elem ); + var state = data.constructor.static.gatherPreInfuseState( $elem, data ); domPromise.done( data.restorePreInfuseState.bind( data, state ) ); } ); } -- 2.20.1