Inside the init function of the event binding handler the for loops over the event names in eventsToHandle, but it picks up extra functions from the object prototype and attempts to register as an event handler.
JQuery throws exception : Uncaught TypeError: [Method Code] has no method 'push'
jsFiddle to replicate : http://jsfiddle.net/slaneyrw/S6VaW/9/
Potential resolution: Need to check if the eventsTohandle "owns" the event name or if it comes from the prototype chain.
see discussion https://groups.google.com/forum/?fromgroups=#!topic/knockoutjs/ixlSf_qg1BE for more information
I agree that it would be best for us to use hasOwnProperty in this loop.
Added code and a spec to address this specific issue. Note: the spec will only fail with jQuery included.
There are other places where we are not using hasOwnProperty that could cause issues if Object.prototype is extended (css, style, attr bindings along with some other utility code). I will log another issue for us to evaluate.
Use hasOwnProperty in the event binding to protect against cases wher…
…e Object.prototype has been extended.
I'd prefer to have a utility function for this as suggested in #687.
Closing as a duplicate of #687 (though we can still refer back to this issue for details).