jenkins-bot has submitted this change and it was merged. Change subject: Get rid of try..catch by using ve.dm.nodeFactory.lookup. ......................................................................
Get rid of try..catch by using ve.dm.nodeFactory.lookup. Change-Id: I017ed60f7d7ce8af34c94fe237cc4101192518f1 --- M modules/ve/dm/ve.dm.Converter.js 1 file changed, 11 insertions(+), 15 deletions(-) Approvals: Catrope: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/ve/dm/ve.dm.Converter.js b/modules/ve/dm/ve.dm.Converter.js index 0bb23bd..f32ab34 100644 --- a/modules/ve/dm/ve.dm.Converter.js +++ b/modules/ve/dm/ve.dm.Converter.js @@ -956,15 +956,11 @@ } function getDataElementOrSlice() { - var dataSlice, j, depth, - handlesOwn = false; - - // TODO: Shouldn't be implemented with try..catch cause it makes debugging harder and sacrifice performance. - try { - handlesOwn = ve.dm.nodeFactory.doesNodeHandleOwnChildren( data[i].type ); - } catch ( e ) {} - - if ( handlesOwn ) { + var dataSlice, j, depth; + if ( + ve.dm.nodeFactory.lookup( data[i].type ) && + ve.dm.nodeFactory.doesNodeHandleOwnChildren( data[i].type ) + ) { j = i + 1; depth = 1; while ( j < data.length && depth > 0 ) { @@ -1269,12 +1265,12 @@ // It looks like the solution would be to avoid descending first ( so ascending // wouldn't be needed ) but note that then code above for handling white spaces // wouldn't execute correctly. - // TODO: Shouldn't be implemented with try..catch cause it makes debugging harder and sacrifice performance. - try { - if ( ve.dm.nodeFactory.doesNodeHandleOwnChildren( data[i].type ) ) { - domElement = parentDomElement; - } - } catch ( e ) {} + if ( + ve.dm.nodeFactory.lookup( data[i].type ) && + ve.dm.nodeFactory.doesNodeHandleOwnChildren( data[i].type ) + ) { + domElement = parentDomElement; + } } if ( ve.isArray( dataElementOrSlice ) ) { -- To view, visit https://gerrit.wikimedia.org/r/64977 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I017ed60f7d7ce8af34c94fe237cc4101192518f1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Inez <i...@wikia-inc.com> Gerrit-Reviewer: Catrope <roan.katt...@gmail.com> Gerrit-Reviewer: Esanders <esand...@wikimedia.org> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits