jquery set haspopup for wp

JavaScript performance comparison

Revision 3 of this test case created by

Preparation code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div class="menu">
<ul>
  <li ><a href="http://www.example.com/" title="Home">Home</a></li>
  <li class="page_item"><a href="http://www.example.com/page1/">Page 1</a><!-- Attr expected here -->
    <ul class='children'>
      <li class="page_item"><a href="http://www.example.com/page1/page11/">Page 11</a></li>
      <li class="page_item"><a href="http://www.example.com/page1/page12/">Page 12</a><!-- Attr expected here -->
        <ul class='children'>
          <li class="page_item"><a href="http://www.example.com/page121/page121/">Page 121</a></li>
          <li class="page_item"><a href="http://www.example.com/page122/page122/">Page 122</a></li>
        </ul>
      </li>
    </ul>
  </li>
  <li class="page_item"><a href="http://www.example.com/page2/">Page2</a></li>
  <li class="page_item current_page_item"><a href="http://www.example.com/page3/">Page3</a></li>
</ul>
</div>
    

Preparation code output

<div class="menu"> <ul> <li ><a href="http://www.example.com/" title="Home">Home</a></li> <li class="page_item"><a href="http://www.example.com/page1/">Page 1</a><!-- Attr expected here --> <ul class='children'> <li class="page_item"><a href="http://www.example.com/page1/page11/">Page 11</a></li> <li class="page_item"><a href="http://www.example.com/page1/page12/">Page 12</a><!-- Attr expected here --> <ul class='children'> <li class="page_item"><a href="http://www.example.com/page121/page121/">Page 121</a></li> <li class="page_item"><a href="http://www.example.com/page122/page122/">Page 122</a></li> </ul> </li> </ul> </li> <li class="page_item"><a href="http://www.example.com/page2/">Page2</a></li> <li class="page_item current_page_item"><a href="http://www.example.com/page3/">Page3</a></li> </ul> </div>

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
ul > li.page_item
$("ul > li.page_item").has("ul").children("a").attr("aria-haspopup","true");
pending…
li.page_item
$("li.page_item").has("ul").children("a").attr("aria-haspopup","true");
pending…
.page_item
$(".page_item").has("ul").children("a").attr("aria-haspopup","true");
pending…
.page_item:has(ul) > a
$(".page_item:has(ul) > a").attr("aria-haspopup","true");
pending…
.menu li:has(ul) > a
$(".menu li:has(ul) > a").attr("aria-haspopup","true");
pending…
.menu .page_item
$(".menu .page_item").has("ul").children("a").attr("aria-haspopup","true");
pending…
.menu li
$(".menu li").has("ul").children("a").attr("aria-haspopup","true");
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