nextNode

Benchmark created by Jonas Fischer on


Preparation HTML

<p><div id='xy'>sdf<span>sdf</span></div><div>sdf<span>sdf</span></div><div>sdf<span>sdf</span></div><div>sdf<span>sdf</span></div><div>sdf<span>sdf</span></div><div>sdf<span>sdf</span></div><div>sdf<span>sdf</span></div></p>
<script>
  var n = Array(function(e) {
   var N = e.nextSibling;
   if (N != null) {
    if (N.parentNode == e) {
     for (var c = e.childNodes, l = c.length + 0; l != 0; l--) {
      if (c[l] == e) {
       l++;
       return c[l] == null ? false : c[l];
      }
     }
     return false;
    }
    else return N;
   }
  }, function(e) {
   var N = e.nextSibling;
   if (N != null) {
    if (N.parentNode == e) {
     var a = e;
     while ((N = a.nextSibling) != null) {
      if (N.parentNode == a) a = N;
      else return N;
     }
     return false;
    }
    else return N;
  
   }
  });
  var t = document.getElementById('xy');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
nextNode 1
n[0](t);
ready
nextNode 2
n[1](t);
ready

Revisions

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

  • Revision 1: published by Jonas Fischer on