From 1346b46eecc59a75d50830866fc0efb38b76404c Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Tue, 26 Aug 2014 18:41:26 +0200 Subject: [PATCH] mw.toolbar: Don't mask the error of button.onClick being invalid Follows-up 7359b97354b49faa4c1. Minor clean up: * Add missing line break. * Add missing description for addButtons(). Change-Id: Ie33b900f1d116044e1aa2d31a23a2128786b7a49 --- resources/src/mediawiki.action/mediawiki.action.edit.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.js b/resources/src/mediawiki.action/mediawiki.action.edit.js index 0ebcd3c89e..eacb9104df 100644 --- a/resources/src/mediawiki.action/mediawiki.action.edit.js +++ b/resources/src/mediawiki.action/mediawiki.action.edit.js @@ -35,11 +35,12 @@ id: b.imageId || undefined, 'class': 'mw-toolbar-editbutton' } ).click( function ( e ) { - if ( $.isFunction( b.onClick ) ) { + if ( b.onClick !== undefined ) { b.onClick( e ); } else { toolbar.insertTags( b.tagOpen, b.tagClose, b.sampleText ); } + return false; } ); @@ -48,6 +49,7 @@ isReady = false; $toolbar = false; + /** * @private * @property {Array} @@ -87,7 +89,10 @@ } }, /** + * Add multiple buttons to the toolbar (see also #addButton). + * * Example usage: + * * addButtons( [ { .. }, { .. }, { .. } ] ); * addButtons( { .. }, { .. } ); * -- 2.20.1