views:

1295

answers:

1

I have an element that is dynamically created with new Element('div') and is then faded in, moved, and faded out. In every browser, my code works as expected – every browser but IE.

Internet Explorer complains that 'undefined' is null or not an object exactly as documented on Prototype's Lighthouse.

To get the error, I write, new Message('Your contact information has been saved');

The source for my Message class is available at this gist.

+3  A: 

“Undefined is null of not an object” is a very basic error message that can be produced in a huge range of situations (it's JScript's effective equivalent of a null pointer exception). So it's unlikely yours is the same error as mentioned above.

I don't get that error though. I get “Invalid argument”, which seems to be caused by:

new Effect.Move(_div, {sync: true, x: '50%', y: 35, mode: 'relative' })

If I change the % to a normal integer pixel value it works fine. x is documented as accepting only an integer value not a CSS measurement; the '%' doesn't work for me in other browsers either (acts as 0). I guess you've made this feature up!

As Fabien mentioned, you also need to insert some var statements, otherwise you're scribbling over the globals and Message will blow up if you try to create two of them. Plus take care not to leave a trailing , in an array literal (due to the commented line), as this confuses IE.

bobince
I think his problem is related to the extra comma after new Effect.Fade(_div, {sync: true}),because of the comment on the next line. I really love the errors thrown by IE...
Fabien Ménager
To bad it doesn't do my every will. Seriously though, global being the default scope saddens me.
arbales
Yes, default-global is an egregious design error in the JavaScript language, and not the only one. :-(
bobince