Test case details

Preparation Code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <div id="el"></div> <script>   var i = 0,       el = document.getElementById('el'),       $el = $(el),       setData = function (element, key, value) {           element['_pref_'+key] = value;       }; </script>

Test cases

Test #1

$el.attr('key-' + Math.floor(Math.random() * 1001), 'val-' + Math.floor(Math.random() * 1001));

Test #2

$el.data('key-' + Math.floor(Math.random() * 1001), 'val-' + Math.floor(Math.random() * 1001));

Test #3

$el.prop('key-' + Math.floor(Math.random() * 1001), 'val-' + Math.floor(Math.random() * 1001));

Test #4

el['key-' + Math.floor(Math.random() * 1001)] = 'val-' + Math.floor(Math.random() * 1001);

Test #5

setData(el,'key-' + Math.floor(Math.random() * 1001),'val-' + Math.floor(Math.random() * 1001));