mw.toolbar: Don't mask the error of button.onClick being invalid
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 26 Aug 2014 16:41:26 +0000 (18:41 +0200)
committerTimo Tijhof <krinklemail@gmail.com>
Tue, 26 Aug 2014 16:41:26 +0000 (18:41 +0200)
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

index 0ebcd3c..eacb910 100644 (file)
                        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}
                        }
                },
                /**
+                * Add multiple buttons to the toolbar (see also #addButton).
+                *
                 * Example usage:
+                *
                 *     addButtons( [ { .. }, { .. }, { .. } ] );
                 *     addButtons( { .. }, { .. } );
                 *