Y.one(document.getElementById(id)) vs $(document.getElementById(id)) (v5)

Revision 5 of this benchmark created on


Description

YUI3 vs jQuery for getting an element by its selector

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js">
</script>
<div id="el">
  Some HTML element
</div>
<script>
  var el = document.getElementById('el'),
      did = 'el',
      jid = '#el',
Y;

  function S4() {
    return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
  }
YUI().use('node', function(Y) {
window.Y = Y
});
</script>

Setup

el.id = did = S4();
    jid = '#' + did;

Test runner

Ready to run.

Testing in
TestOps/sec
Y.one('#id')
Y.one(window[did]);
ready
$('#id')
$(document.getElementById(did))
ready

Revisions

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