From: Timo Tijhof Date: Tue, 26 Aug 2014 16:41:26 +0000 (+0200) Subject: mw.toolbar: Don't mask the error of button.onClick being invalid X-Git-Tag: 1.31.0-rc.0~14274 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/?a=commitdiff_plain;h=1346b46eecc59a75d50830866fc0efb38b76404c;p=lhc%2Fweb%2Fwiklou.git 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 --- 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( { .. }, { .. } ); *