| <script src="../resources/magnitude-perf.js"></script> |
| <script> |
| |
| var element, rel, relToRemove, type; |
| |
| // Test 1 tests that remove is linear when there are N rels. |
| |
| function setupFunction1(magnitude) |
| { |
| element = document.createElement(type); |
| relToRemove = 'b'; |
| rel = Array(magnitude).join('a ') + relToRemove; |
| } |
| |
| // Test 2 tests that remove is linear when the length of the rel is N. |
| |
| function setupFunction2(magnitude) |
| { |
| element = document.createElement(type); |
| relToRemove = Array(magnitude + 1).join('a'); |
| rel = relToRemove; |
| } |
| |
| function test(magnitude) |
| { |
| element.rel = rel; |
| element.relList.remove(relToRemove); |
| } |
| |
| Magnitude.description('Tests that relList remove is linear.'); |
| type = 'a' |
| Magnitude.run(setupFunction1, test, Magnitude.LINEAR); |
| Magnitude.run(setupFunction2, test, Magnitude.LINEAR); |
| type = 'area' |
| Magnitude.run(setupFunction1, test, Magnitude.LINEAR); |
| Magnitude.run(setupFunction2, test, Magnitude.LINEAR); |
| type = 'link' |
| Magnitude.run(setupFunction1, test, Magnitude.LINEAR); |
| Magnitude.run(setupFunction2, test, Magnitude.LINEAR); |
| |
| </script> |
| </body> |