简体   繁体   中英

Why does jQuery stop debugger?

I noticed a strange problem when enabling the "break on exception" feature, in Firefox or Chrome/Chromium. It stops on

push.apply( results,
    newContext.querySelectorAll( newSelector )
);

even though apparently there is no error on this line. Is this an issue with jQuery, or Firefox?

When I turn off the pause-on-exception, it doesn't show exceptions in console.

The top caller on the stack was jQuery.fx.tick at the time of exception.

I think what you are looking for is

Array.prototype.push.apply( results,
    newContext.querySelectorAll( 'div')
);

The push method you are looking for is a prototype method of Array type.

or as a short hand

[].push.apply( results,
    newContext.querySelectorAll( 'div')
);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM