window.setTimeout call functions with parameters / DOM vs MSDN vs MDN

One of my latest WTFs came from a javascript diference between the MSDN (yes… Microsoft Developer Network) and the rest of the world which may actually follow the latest DOM description.

Even though, still presents this as MSDN does, I’m pretty sure the DOM evolved since. So let’s see:

MSDN and w3schools present window.setTimeout as:

while in MDN you will find another version of calling this function:

Calling a function through window.setTimeout is available since Javascript v-1.2, which from my vague knowledge was supported even by Internet Explorer 6.0, what I don’t really understand is why this is done so freaking ugly that you can’t set a timeout for a function call while mentioning its parameters as well.

While every browser based on gecko or webkit will always recognize the MDN calling version, Internet Explorer will not. The only way of making this available in IE is by instantiating the function each time you will actually call it. i.e.

I know. This kinda sucks, but this is the only way I could find to make things work. Now… I let your imagination fly in how to use this piece of crap. Have fun!

Leave a Reply

Your email address will not be published. Required fields are marked *