Hello,

Run the following code snippet in Firefox and open up Firebug. It
fires a custom event upon left or right click. The handlers for
'myclick.left' and 'myclick.right' work as expected. The problem is
that 'any click' is only logged to the console in case of a right
click, and not in case of a left click. That doesn't make sense to me.
Is this a bug or am I missing something??

        $().
                bind('myclick.left', function() {
                        console.log('left click');
                }).
                bind('myclick.right', function() {
                        console.log('right click');
                }).
                bind('myclick.left myclick.right', function() {
                        console.log('any click');
                });

        $().
                click(function(e) {
                        var ns;
                        switch (e.which) {
                                case 1:
                                        ns = 'left';
                                        break;
                                case 3:
                                        ns = 'right';
                                        break;
                        }
                        $().trigger('myclick.' + ns);
                });

Reply via email to