jQuery().prop vs jQuery().val (v70)

Revision 70 of this benchmark created on


Description

if so (el = document.getElementById('el'))

try this :D

Preparation HTML

<script src="//code.jquery.com/jquery-git2.js"></script>

<input id="el" value="stuff" />

Setup

var i = 0,
          el = document.getElementById('el'),
          $el = $(el);

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery.fn.val
$el.val();
ready
jQuery.fn.prop
$el.prop('value');
ready
JS
el.value;
ready
JS getAttribute
el.getAttribute('value');
ready
JQuery to Js
$el.get(0).value;
ready
JQuery to Js Attr
$el.get(0).getAttribute('value');
ready
JQuery to Js2
$el[0].value;
ready

Revisions

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