forked from WebKit/WebKit-http
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass-list-remove.html
35 lines (27 loc) · 896 Bytes
/
class-list-remove.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<script src="../resources/magnitude-perf.js"></script>
<script>
var element, className, classToRemove;
// Test 1 tests that remove is linear when there are N class names.
function setupFunction1(magnitude)
{
element = document.createElement('div');
classToRemove = 'b';
className = Array(magnitude).join('a ') + classToRemove;
}
// Test 2 tests that remove is linear when the length of the class name is N.
function setupFunction2(magnitude)
{
element = document.createElement('div');
classToRemove = Array(magnitude + 1).join('a');
className = classToRemove;
}
function test(magnitude)
{
element.className = className;
element.classList.remove(classToRemove);
}
Magnitude.description('Tests that classList remove is linear.');
Magnitude.run(setupFunction1, test, Magnitude.LINEAR);
Magnitude.run(setupFunction2, test, Magnitude.LINEAR);
</script>
</body>