JQuery error when extending prototype object

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

For example jsFiddle

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

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

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

Why is this happening? Is there a workaround or way to fix this error in jQuery?

+4
source share
1 answer

This report says they don’t want to fix it. Therefore, do not use Object.prototype when working with jquery.

+3
source

Source: https://habr.com/ru/post/1501524/


All Articles