> I guess i am doing something wrong. If i try this
>
> $('#mainWindow').click(function() { alert("Hello"); });
> $("#mainWindow").unbind( "click", function() { alert("Hello"); });
>
> where the functions are identical, it still does not work.
> It will invoke the alert function when i click in the mainWindow. 
>
> I must be missing something. 

The function text is identical, but they are not the same function object.
The .unbind() is getting a different function so it doesn't match the
original in .bind().

You can check the ECMA 262 spec but this is what I recall:

1) A "new Function(...)" always creates a new unique function object each
time it executes--even if it has the same text each time.

2) A function created inside an eval() always creates a new unique function
object each time it executes.

3) An anonymous inline function encountered at a specific point in static
program text represents a specific function object. (This is the rule that
causes problems for the example above.)

4) A Javascript implementation can use the same function object for two
different functions declared in static program text only if it can ensure no
interference between the two. In practice this is nearly impossible to do,
so I don't think any interpreter does it. (Think of issues like closures, or
static properties assigned to the function object itself.) 



_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to