Werdna has submitted this change and it was merged.
Change subject: Fix issue with deferred object config preprocessing, it would
also dig into jQuery objects
......................................................................
Fix issue with deferred object config preprocessing,
it would also dig into jQuery objects
Change-Id: Idcb8e4e3025f639e3bf1f50aa2eb5a0ad0d9b713
---
M resources/defer.js
1 file changed, 9 insertions(+), 5 deletions(-)
Approvals:
Werdna: Verified; Looks good to me, approved
diff --git a/resources/defer.js b/resources/defer.js
index 88b0e03..0c50403 100644
--- a/resources/defer.js
+++ b/resources/defer.js
@@ -3,7 +3,6 @@
$( function() {
function instantiateFromParameters( config ) {
var className = config['class'],
- error = false,
newItems;
if ( typeof OO.ui[className] === 'undefined' ) {
@@ -11,7 +10,7 @@
.text( 'Unable to load ' + className );
}
- preprocessConfig( config );
+ error = preprocessConfig( config );
// Pass out errors
if ( error ) {
@@ -26,6 +25,9 @@
}
function preprocessConfig( config ) {
+ var error = false,
+ newItems = [];
+
if ( config.items ) {
newItems = [];
$.each( config.items, function( index, item ) {
@@ -45,12 +47,14 @@
$.each( config, function( name, value ) {
if ( String(name).substr( 0, 1 ) === '$' ) {
config[name] = $( value );
- }
-
- if ( typeof value === 'object' ) {
+ } else if ( typeof value === 'object' &&
$.isPlainObject( value ) ) {
preprocessConfig( value );
}
} );
+
+ if ( error ) {
+ return error;
+ }
}
$( '.ooui-deferred' ).each( function() {
--
To view, visit https://gerrit.wikimedia.org/r/192799
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Idcb8e4e3025f639e3bf1f50aa2eb5a0ad0d9b713
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OOUIPlayground
Gerrit-Branch: master
Gerrit-Owner: Werdna <[email protected]>
Gerrit-Reviewer: Werdna <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits