<!doctype html>
<script src="../resources/runner.js"></script>
<div id="hidden" style="height:0px; overflow:hidden;"></div>
<input type="password">
<script>
const kCount = 100;
const hidden = document.getElementById('hidden');
const password = document.querySelector('input[type=password]');
hidden.innerHTML= '<p>foo bar</p>'.repeat(999);
PerfTestRunner.measureTime({
description: 'Measures performance of delete in password field with many hidden elements',
setup: () => {
password.value = 'x'.repeat(kCount);
password.focus();
},
run: () => {
for (let counter = 0; counter < kCount; ++counter)
document.execCommand('delete');
},
});
</script>