Hi,

You didn't actually say, but it looks like you're using Prototype's
Class.create to create your `B` class, is that right? If so, you don't
call the `initialize` function directly, you use `new B(...)`. E.g.:

* * * *
var b = new B({   // <== not B.initialize
    foo: "foo",
    bar: "bar",
    callback1: function () {
        // do some stuff
    }.bind(this),
    callback2: function () {
        // do some more stuff
    }.bind(this)
});
* * * *

Internally, the constructor function will call `initialize` for you.

Separately, in your B initializer code:

* * * *
// in class B's initialize function:
initialize: function(options) {
    Object.extend(this.options, options);
    // ...
}
* * * *

Do you every assign anything to `this.options`? Because that code
isn't...

Don't know whether either of those is actually the problem, but they
jumped out.

HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com


On Jun 15, 4:53 pm, Cameron <[email protected]> wrote:
> Hello all,
>
> I have been getting a strange error from IE when I run my web app
> built on prototype. I think it might be caused by Object.extend, but
> I'm not positive. I am tying to pass an options object to an
> initialization function of my class, and then within that function, I
> extend the default options with the options that are passed in (pretty
> standard practice, from what I can tell). Two of my options, however,
> happen to be callback functions that are bound to the class that is
> doing the initialization on this new object.
>
> For example:
>
> // inside some method of class A:
>
> // initialize class B with config options
> var b = B.initialize({
>     foo: "foo",
>     bar: "bar",
>     callback1: function () {
>         // do some stuff
>     }.bind(this),
>     callback2: function () {
>         // do some more stuff
>     }.bind(this)
>
> });
>
> ....
>
> // in class B's initialize function:
> initialize: function(options) {
>     Object.extend(this.options, options);
>     // ...
>
> }
>
> When I remove the Object.extend, it seems to stop giving me the error
> (but then, of course, I don't get the callback...). Is there something
> wrong with extending an object like this (specifically when it's bound
> to another object?). I've done some searching on this particular
> error, but it seems like it could occur in many different situations
> (read:http://cappuccino.org/discuss/2010/03/01/internet-explorer-global-var...
> this is crazy....).
>
> Any insight would be greatly appreciated!
>
> Thanks,
> Cameron

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to