Excerpts from the Javascript API

November 19, 2004

Programming in Javascript is like trying to hit a moving target. Below are a few excerpts you would expect to find in the non-existent Javascript API. I will leave it as an exercise to identify the methods to which I am referring.

Sometimes this method works, sometimes it doesn't work. Some clients don't even implement this method. The only way to know if the method is active is to try to run it and see if it does anything.
The name of this property is different for just about every client. On some clients, the same name is used for a completely different purpose. Refer to the countless charts that exist on the web to help decifer this situation.
Some runtime environments will causes leaks if calling this method in a particular way since those clients don't implement garbage collection for this type of object.
Some runtimes will implement security restrictions on this method, causing it to fail, but there is no way to know ahead of time which restrictions are being imposed. It depends on the decision of the PR department.
When this method is invoked by the client, it either takes one argument or no arguments. When it takes no arguments, the caller's state must be retrieved from the global scope. However, that object is completely different from the one passed as an argument.
This method returns the dimensions of an object, but often times it returns a value slightly more or slightly less, depending on the client, the rendering mode, and the attributes of the object. In standards compliance mode, this method may even be located on a completely different object. To be sure, handle it conditionally by detecting the client version. However, that is often difficult since some clients will fake their signature. It is usually necessary to test it a couple hundred times before you see the way it actually works.
In some cases, the client intepreter may be disabled entirely. Under this circumstance, it is necessary to handle the problem using a completely different solution.

Posted at 07:46 AM in Javascript | Permalink Icon Permalink

Got Something to Say?

Comment Form
Personal Info

Remember personal info?

Body