Revision control

1
<script src="../resources/magnitude-perf.js"></script>
2
<script>
3
4
var element, rel, relToRemove, type;
5
6
// Test 1 tests that remove is linear when there are N rels.
7
8
function setupFunction1(magnitude)
9
{
10
element = document.createElement(type);
11
relToRemove = 'b';
12
rel = Array(magnitude).join('a ') + relToRemove;
13
}
14
15
// Test 2 tests that remove is linear when the length of the rel is N.
16
17
function setupFunction2(magnitude)
18
{
19
element = document.createElement(type);
20
relToRemove = Array(magnitude + 1).join('a');
21
rel = relToRemove;
22
}
23
24
function test(magnitude)
25
{
26
element.rel = rel;
27
element.relList.remove(relToRemove);
28
}
29
30
Magnitude.description('Tests that relList remove is linear.');
31
type = 'a'
32
Magnitude.run(setupFunction1, test, Magnitude.LINEAR);
33
Magnitude.run(setupFunction2, test, Magnitude.LINEAR);
34
type = 'area'
35
Magnitude.run(setupFunction1, test, Magnitude.LINEAR);
36
Magnitude.run(setupFunction2, test, Magnitude.LINEAR);
37
type = 'link'
38
Magnitude.run(setupFunction1, test, Magnitude.LINEAR);
39
Magnitude.run(setupFunction2, test, Magnitude.LINEAR);
40
41
</script>
42
</body>