扩展对象原型时出现jQuery错误 [英] jQuery error when extending object prototype

查看:90
本文介绍了扩展对象原型时出现jQuery错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我扩展 Object 原型并尝试使用jQuery 2.0.3的某些功能,我会收到错误......

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

例如 jsFiddle

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

如果我这样做然后点击任何div我会收到错误

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

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

为什么会这样?是否有解决方法或方法来修复jQuery中的这个错误?

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

推荐答案

在此报告他们说他们不想解决这个问题。所以在使用jquery时不要使用Object.prototype。

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

这篇关于扩展对象原型时出现jQuery错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆