| OLD | NEW |
| (Empty) |
| 1 <script src="../resources/magnitude-perf.js"></script> | |
| 2 <script> | |
| 3 | |
| 4 var element, className, classToRemove; | |
| 5 | |
| 6 // Test 1 tests that remove is linear when there are N class names. | |
| 7 | |
| 8 function setupFunction1(magnitude) | |
| 9 { | |
| 10 element = document.createElement('div'); | |
| 11 classToRemove = 'b'; | |
| 12 className = Array(magnitude).join('a ') + classToRemove; | |
| 13 } | |
| 14 | |
| 15 // Test 2 tests that remove is linear when the length of the class name is N. | |
| 16 | |
| 17 function setupFunction2(magnitude) | |
| 18 { | |
| 19 element = document.createElement('div'); | |
| 20 classToRemove = Array(magnitude + 1).join('a'); | |
| 21 className = classToRemove; | |
| 22 } | |
| 23 | |
| 24 function test(magnitude) | |
| 25 { | |
| 26 element.className = className; | |
| 27 element.classList.remove(classToRemove); | |
| 28 } | |
| 29 | |
| 30 Magnitude.description('Tests that classList remove is linear, ' + | |
| 31 'both in number of class names ' + | |
| 32 'and in length of class name.'); | |
| 33 Magnitude.numTrials = 5; | |
| 34 Magnitude.successThreshold = 0.40; // 2 out of 5 | |
| 35 Magnitude.tolerance = 0.35; | |
| 36 Magnitude.trim = 1; | |
| 37 | |
| 38 Magnitude.initialExponent = 9; | |
| 39 Magnitude.numPoints = 5; | |
| 40 Magnitude.run(setupFunction1, test, Magnitude.LINEAR); | |
| 41 Magnitude.initialExponent = 12; | |
| 42 Magnitude.numPoints = 5; | |
| 43 Magnitude.run(setupFunction2, test, Magnitude.LINEAR); | |
| 44 | |
| 45 </script> | |
| 46 </body> | |
| OLD | NEW |