Be careful using jQuery’s .click()

19. Dezember 2011

Today I would like to share my current experience with jQuery event handler registration and why you should not use jQuery’s .click()-function:

In my current project I need to use lots of javascript and of course startet from begin to use jQuery as one of the most useful (if not THE most useful) javascript-frameworks. Currently my script uses plenty of event-handlers all added via .bind() from jQuery. Additional I use a nice little script for contextmenues which I found to be very useful and easy to integrate (

Unfortunately this contextmenu uses .click() to bind the handler for the menu-entries. For the first weeks this did noch caused any issue – unless last weeks Internet Explorer update (maybe it could be of interested that we primarly develop for IE and currently do not regard the other browsers). So today one of my colleagues came up and reported to me that the context menu is not working anymore.

So what seems to have happened is that Microsoft decided to fix their event-handling: My code defines a global mouse-down-event which eleminates data which my contextmenu needs. Of course it make sense that a mouse-down is called before a mouse-click as the click-event only is kind of virtual event and combines mouse-down and mouse-up. But as it always worked fine for me and I did not took a closer look into the context-menu-script…

Here the code as it was before:


And as I modified to prevent the global mouse-down-event:

row.find('a').bind('mousedown', function (e) {
                        return false;
                    }).bind('mouseup', item.action);
Happy Shopping!!

ReSharper 6.0 – First Impressions

16. Dezember 2011

About a week ago I’ve been allowed to use the companies credit card to purchase an update of ReSharper to version 6.0. ReSharper is a really nice plug-in for Microsoft Visual Studio enhancing it with several really useful functions (eg. „Find Usage“, a whole pallette of refactoring tools and code-style-checks).

The new version offers better support for JavaScript and HTML5 and many other things which I’ve been not able to test yet.

But nevertheless I want to share my first experiences:
One of the very fist things I recognized was the visual alert that I’m not following the coding-conventions – especially the naming of variables and functions. With one of my colleagues I discussed the pro’s and cons about this special convention – but finally to say that I think this is a great feature as you start writing code which follows at least one 😉

Also improved are the automatic correction options: Now you’re presented to mostly all „wrong“ parts of code some options to fix it or improve it. Something I do not want to miss anymore…

But with all these „wow“s and „yeah“s there is also one major „d’oh“: The speed of my IDE went down the basement… At several moments I’m able to type words faster than they appear on the screen – not because I’m a hell of a writer but the IDE reacts many times slower than without the plugin. Hopefully the guys from JetBrain will fix this soon.

Stay tuned in case I write a longer review after working more and more with ReSharper.

Happy Shopping!!!