Revision control

1
<script src="../resources/magnitude-perf.js"></script>
2
<script>
3
var key = 'counter';
4
5
function setupFunction(magnitude)
6
{
7
element = document.createElement('div');
8
counter = 0;
9
}
10
11
function test(magnitude)
12
{
13
element.setAttribute(key, counter ? counter-- : counter++);
14
}
15
16
Magnitude.description("Tests that setAttribute is constant time.");
17
Magnitude.run(setupFunction, test, Magnitude.CONSTANT);
18
</script>
19
</body>