Note that there are some explanatory texts on larger screens.

plurals
  1. POChrome sometimes calls incorrect constructor
    text
    copied!<p>We have a web site that uses extensively jQuery and it works fine in Firefox and IE. However in Chrome, we are getting frequently (and semi-randomly) <code>Uncaught TypeError: Cannot call method 'apply' of undefined</code> (also other jQuery methods appear in place of <code>apply</code>).</p> <p>We managed to track down the problem to jQuery method <code>pushStack()</code>.</p> <p>Original source code (jQuery 1.7.1):</p> <pre><code>// Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems, name, selector ) { // Build a new jQuery matched element set var ret = this.constructor(); // (etc.) } </code></pre> <p>Instrumented code:</p> <pre><code>pushStack: function( elems, name, selector ) { if (!(this instanceof jQuery.fn.init)) throw this; // Build a new jQuery matched element set var ret = this.constructor(); if (!(ret instanceof jQuery.fn.init)) { console.log("pushStack&gt;this: " + this.constructor); console.log("pushStack&gt;ret: " + ret.constructor); throw ret; } // (etc.) } </code></pre> <p>In most cases <code>pushStack()</code> runs correctly. However sometimes Chrome constructs an object of type <code>Object</code> instead of <code>jQuery.fn.init</code>. Console output:</p> <pre><code>pushStack&gt;this: function ( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' return new jQuery.fn.init( selector, context, rootjQuery ); } pushStack&gt;ret: function Object() { [native code] } Uncaught #&lt;Object&gt; </code></pre> <p>Did anybody encounter similar problem? Is it a (known) bug of Chrome?</p> <p><strong>Update</strong></p> <p>I managed to simplify our page, so that it could be loaded on its own. I filled <a href="http://code.google.com/p/chromium/issues/detail?id=125148" rel="noreferrer">bug in Chromium project</a> project, the page for reproducing the issue is attached there. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload