What can cause this randomly occurring error inside jQuery itself?

I'm banging my head about it. Every 5-10 times I restart my application, I get a strange error that occurs inside jQuery. I am trying to add breakpoints inside an uncompressed version of jQuery to try to backtrack from the error, but Chrome never stops for them, instead it always goes to the error.

I am using jQuery 1.7.2, but this error also occurs in versions 1.7 and 1.6.1.

In my javascript application, I call this line of code:

this.element.find('.banner-btn')

Where this.elementis the jQuery object. There is no reason why this should cause a problem, and 9 times out of 10 there are no problems. But randomly something breaks, and then every time this line of code is called the result, this is some kind of version of this stack trace:

Uncaught TypeError: Cannot call method 'apply' of undefined
makeArrayjquery-1.7.2.js:4858
Sizzlejquery-1.7.2.js:5110
jQuery.fn.extend.findjquery-1.7.2.js:5432

, , $.fn.find, . , jQuery, . - , ?

:

jQuery , . .

DOM, jQuery pushStack. jQuery.fn.find jQuery. - - jQuery, - jQuery-. .

, pushStack, 241 jquery-1.7.2.js:

// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems, name, selector ) {
if(window._debug_jQuery_pushStack) { debugger }
    // Build a new jQuery matched element set
    var ret = this.constructor();

// ---- the function continues, but this is enough for us ----

, var ret = this.constructor();, jQuery. . - this , jQuery. , : ? , 10 20 , .

+5
2

, Chrome - . # 125148. - pushStack :

pushStack: function( elems, name, selector ) {
    // Build a new jQuery matched element set
    var ret = this.constructor();

    // temporary workaround for chrome issue #125148
    // http://code.google.com/p/chromium/issues/detail?id=125148
    if (!(ret instanceof jQuery.fn.init)) {
        console.log("applying pushStack fix");
        ret = new jQuery.fn.init();
    }

    // ... snip ...

. .

+5

, jquery, - , jquery . "undefined". - jQuery (, var, ) , . backbone.js jquery DOM. , var jquery, , .

, , , , , , , ; . , , var , , .

+2

All Articles