From: Thiemo Mättig Date: Thu, 25 Feb 2016 13:34:01 +0000 (+0100) Subject: OOjs UI: Fix #gatherPreInfuseState called incorrectly, causing TypeErrors X-Git-Tag: 1.31.0-rc.0~7838^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=faba9bc36dd35a75d4b0d7c5c7d325be613cf608;p=lhc%2Fweb%2Fwiklou.git 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 --- 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 ) ); } ); }