Archive

Posts Tagged ‘JavaScript’

JavaScript is great, but its implementations are terrible

October 6, 2011 Leave a comment

Disclaimer: this is a rant about how browsers make our lives hell. It doesn’t state facts, only personal opinions, and even that only to vent my frustration after 3 days suffering with JavaScript.

I’m currently in fight with all my browsers trying to give the zkanji site a facelift. This being a hobby project, I’m experimenting a lot with JavaScript and the jQuery library to create some fun effects that nobody really needs. Everyone who ever tried programming in JS knows, that all browsers react a bit differently to the gentle pushes of programmers, so creating anything but the most simple scripts causes headaches all over the globe. But the truth is, this is not JavaScript’s fault.  The language has great features and it’s more flexible than most other scripting languages out there. The only one thing missing is real object oriented inheritance, but even that can be simulated like it would be part of the language. (As done by the Prototype library. (Is there any other language out there that can be expanded like that?)) The only other one thing missing is the ability to use it for some general purpose outside a browser, but that would be too much to ask.

Unfortunately even a great language can become a nuisance if its working environment is web browsers. Since the browser war started between MSIE and Netscape more than a decade ago, all major browsers try to be a bit different, but that wouldn’t be a problem in itself. This only started to take casualties once the browser makers with the biggest influence went against each other in what their browsers can do and how it does that, when it should work the same way for everyone. It’s generally accepted knowledge, that IE is buggy. Less people are willing to admit that Firefox is buggy as well. Even less about Chrome. (I won’t even start with the rumors about what these browsers do incorrectly on purpose.) Not just that, but even the “official” specifications can set ambiguous rules, that the different companies and organizations can and will interpret differently.

One of the casualties of this war was JavaScript, which, although being one of the greatest things on Earth (with a little exaggeration), is probably hated by millions of programmers everywhere, as its implementations are all terrible. (Saying that the implementations are terrible is misleading, what I really mean is JavaScript’s ability to interact with the browser and manipulate content is bad, because the creators of browsers don’t have an IQ above… above the IQ of the general population, maybe, so this says nothing, but I think that programmers of web browser either don’t care, or are forced to make something useless.)

There is something terrible wrong with the official JavaScript specifications as well, because there is no way to find out whether the mouse was moved out of the document or not. (Yes, I know there is, but it’s unreliable and doesn’t work in some situations.) After reading the whole blog you probably know by now that this is the current problem I face, the reason why I started this whole rant, so if you know a perfect solution that would help me in any way, don’t hesitate to say it. (But make that solution work even when the mouse moves out of the browser window while jQuery animates something, and it can’t rely on coordinates, because always-on-top windows can cover half of the browser and the mouse can pass over those too. I’m not really expecting a solution, but one can hope.)

Update: Chrome and Opera never fires the mouseout / mouseleave events when mouse moves to a floating on-top window, firefox does randomly, while it always seems to work with IE. (There are things IE gets right and the others don’t.)

Advertisements
Categories: Rant Tags: , ,