ChromeでデバッグしてるとjQuery内でいちいち停止する

という問題がいつの間にやら起きるようになり、地味につらさが募っていた。 Webで検索すると下記のページを見つけて原因を把握した。

http://stackoverflow.com/questions/8399567/chrome-developer-tools-pauses-the-initialization-of-jquery-1-7

要するに、「例外が発生したらそこで停止する」というオプションを有効にしていた。

f:id:tsimo:20130910135426p:plain

クリックするだけで設定が切り替わるので、意図せずクリックしたのだろう。

jQuery内で例外が発生していたわけだが、ブラウザごとの挙動の違いで処理経路を変える手段として例外を発生させていたようだった。

    assert(function( div ) {

      // Support: Opera 10-12/IE8
      // ^= $= *= and empty values
      // Should not select anything
      // Support: Windows 8 Native Apps
      // The type attribute is restricted during .innerHTML assignment
      var input = doc.createElement("input");
      input.setAttribute( "type", "hidden" );
      div.appendChild( input ).setAttribute( "t", "" );

      if ( div.querySelectorAll("[t^='']").length ) {
        rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
      }

      // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
      // IE8 throws error here and will not see later tests
      if ( !div.querySelectorAll(":enabled").length ) {
        rbuggyQSA.push( ":enabled", ":disabled" );
      }

      // Opera 10-11 does not throw on post-comma invalid pseudos
      div.querySelectorAll("*,:x");  // ### ここで例外が発生していた ###
      rbuggyQSA.push(",.*:");
    });
  }

スッキリした。