Complex world of JavaScript

I’ve been working a lot with JavaScript lately. It is a very cool language and is very flexible, which supports doing very neat things in it. It has it’s own limitations, but what language doesn’t? It is a scripting language and because of that it is very dynamic by its own nature. It allows to modify objects and methods on the fly and therefore opening a window to a whole set of new programming patterns, tricks, and ways to solve various problems. Even though I’ve been developing with it for quite some time, about a year and a half, it often feels like I’m just scratching the surface.

I’m using it, as most JavaScript developers do, for client-side browser scripting. This only adds to the complexity of the development. Most popular browsers, such as Internet Explorer and Mozilla, support the actual JavaScript quite well. There are minor differences in how certain things work and I’m only aware of those differences. I’ve never actually had to work around them yet. However, knowing JavaScript is not enough. It needs to interact with the browser’s DOM for the user to be able to see any results of the script execution (there are small exceptions, but from a practical stand point it doesn't really matter). This is where things start to fall apart. Both IE and Mozilla allow doing very neat things through their DOM with the web page the user is looking at. However, they both require different approach to achieve the same goal. Mozilla is more W3C complaint, but I’m pretty sure it doesn’t implement the standard to the letter. It doesn’t matter anyway since the most widely used browser follows the standard to a much smaller degree. The most exciting part of working with DHTML – events, is totally different in IE.

There are other differences as well, as well as bugs/features in IE that make it very hard to do serious script development. For example IE is pretty famous for leaking memory due to circular references between DOM object and JavaScript objects. Apparently, Mozilla does it too, but on such small scale that it’s almost impossible to notice. Anyhow, at first I thought it was a bug in IE, but now I’m not so sure. I’m more under impression now that Microsoft was not planning for IE to be used for serious web application development and decided not to go through all the trouble of making sure there was no leakage. Whatever the cause I’m not sure how hard it is to fix the problem in IE and I’m not going to point any fingers. My life doesn’t get easier though, since the problem remains.

Well, I’ve got fed up with all the problems and differences, and decided to get my hands dirty and write by own JavaScript library to abstract what I don’t want to deal with away from me. Somewhere along the lines, I figured it would be cool to add commonly used visual controls, such as menu, to the library. So there you have it, I’m reinventing the wheel as I’m sure many developers wrote their own libraries to abstract away these problems. However, none of the solutions I found has satisfied me. Almost nobody for example take into account the leaky nature of the Internet Explorer. Therefore, unsatisfied and frustrated I have decided to spend some time and shape the wheel to the form I find the most pleasant to my eye. When it’s in a usable state I intend to release it under LGPL or similar license. Of course, I also intend to document my experience of writing it and post all neat tricks present JavaScript I learn about. Tomorrow, or sometime soon, I intend to write more about the tools I use, and about how they turn JavaScript development from very hard into just something hard.



Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: Slava
Posted on: 5/19/2005 at 11:21 AM
Categories: Web development
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Related posts

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

Monday, January 05, 2009 10:01 AM