开发者

jQuery extend makes Array.prototype.push error

Ive tried some extend script with jQuery. Here is the code atm:

http://teszt.aloetravel.com/cica/test.html

My problem is that, it's works perfectly in JS Bin but in the editor mode only! Nowhere else :(

http://jsbin.com/epiked/2 < JSBin here, error is the same. Now try to edit it, and it will work.

Why? :(

The error message I have:

Uncaught TypeError: Array.prototype.push called on null or undefined
e.fn.e.pushStackjquery.min.js:2
f.each.f.fn.(anonymous function)jquery.min.js:4
(anonymous function)2:66
f.extend._Deferred.e.resolveWithjq开发者_如何学Cuery.min.js:2
e.extend.readyjquery.min.js:2
c.addEventListener.C

What is the problem? I did not use push method in my script. So in must be something extending error, while I'd like to use parent->child relations on jQuery and my other scripts.


To simply get rid of errors you're getting, return something from your constructors (propably to keep jQuery chaining happy). http://jsbin.com/epiked/3

Note: Although your code won't throw errors no more (after my fixes), take ThiefMaster comment into an account and consider once again what you're trying to achive by extending your objects with jQuery. Maybe it's not the best way to go, unless you're absolutely sure that you know what you're doing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜