BrunoLM
BrunoLM

Reputation: 100322

jQuery error when extending object prototype

If I extend the Object prototype and try to use some functions of jQuery 2.0.3 I get errors...

For example jsFiddle

Object.prototype.GetHashCode = function() { return 1; };
$(document).on("click", "div", function() { });

If I do this and then click any div I get an error

Uncaught TypeError: Object function () { return 1; } has no method 'exec' 

Why does it happen? Is there a workaround or a way to fix this bug in jQuery?

Upvotes: 4

Views: 854

Answers (1)

georg
georg

Reputation: 214949

In this report they say they don't want to fix that. So don't use Object.prototype when working with jquery.

Upvotes: 5

Related Questions