Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome Developer Tools pauses the initialization of jQuery 1.7

Chrome's developer tools are an excellent set of tools that I love to use. Unfortunately, I've come across a very strange issue as of late when I refresh the page whilst keeping the developer tools window open: Chrome pauses the javascript execution and points to the line specified below.

try {
        // This should fail with an exception
        // Gecko does not error, returns false instead
        matches.call(document.documentElement, "[test!='']:sizzle"); // this is where it breaks

} catch (pseudoError) {
    pseudoWorks = true;
}

An exception causes the script to pause, despite that the exception itself is positioned within a try-catch block. Is there any way I can alter this behaviour? Or is there something that I've missed?

like image 458
Leonard Avatar asked Dec 06 '11 12:12

Leonard


2 Answers

I've just solved this problem (in my case, might be different). I have accidentally clicked on "Pause on Exceptions" button in chrome's console. This one: https://developers.google.com/chrome-developer-tools/docs/scripts-breakpoints#js_exceptions

Here's the location of that small, easy-to-miss Pause on Exceptions button, and its three toggle states:

Image showing small "Pause on Exceptions" button

like image 103
psycho brm Avatar answered Oct 20 '22 00:10

psycho brm


Possibly it's a known bug , check this: http://bugs.jquery.com/ticket/7535 . I have found this solution there, I hope it helps:

 try {
// This should fail with an exception
// Gecko does not error, returns false instead
// <orig. $jquery-1.5:>
// matches.call( document.documentElement, "[test!='']:sizzle" );
// <proposal to Ticket #7535, 2011-03-24:>
  if( ! html.mozMatchesSelector || document.currentScript ){
    matches.call( html, "[test!='']:sizzle" );
  }
//else{
// /*FF lt 4*/
//}


} catch( pseudoError ) {
    pseudoWorks = true;
  }
  // <testing only>
  // alert('MalformedSelectorException thrown: ' + pseudoWorks );
like image 28
tildy Avatar answered Oct 19 '22 22:10

tildy