Jquery 1.7.2 quickIs vs Jquery 1.9.1 .find()

JavaScript performance comparison

Revision 5 of this test case created by

Preparation code

<fieldset class="someclass">
  <legend>match</legend>
  <table>
    <tbody>
      <tr>
        <td>
          <table>
            <tbody>
              <tr>
                <td>
                  <span>
                    <a href="#">
                      <code>
                        <b id="target">target</b>
                      </code>
                    </a>
                  </span>
                </td>
              </tr>
            </tbody>
          </table>
        </td>
      </tr>
    </tbody>
  </table>
</fieldset>
<script src = "http://code.jquery.com/jquery-1.7.2.js"></script>
<script>
  var sel = ".someclass",
    rClass = new RegExp( "(?:^|\\s)" + sel.slice(1) + "(?:\\s|$)" ),
    $target = $("#target"),
    $container = $( document.body )
      .on( "delegated", sel, function( evt ) {
        // Handler body here
      })
      .on( "direct", function( evt ) {
        var target;
        jQuery( evt.target ).parents().each(function( el ) {
          if ( el.className && rClass.test( el.className ) ) {

            // Store and stop checking
            target = el;
            return false;
          }
        });
        if ( !target ) {
          return;
        }

        // Handler body here
      });
</script>
    

Preparation code output

<fieldset class="someclass"> <legend>match</legend> <table> <tbody> <tr> <td> <table> <tbody> <tr> <td> <span> <a href="#"> <code> <b id="target">target</b> </code> </a> </span> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </fieldset>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
delegated
$target.trigger("delegated");
pending…
direct
$target.trigger("direct");
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL.

0 Comments

match
target