fix(fill): use HTMLInputElement.select

This commit is contained in:
Arjun Attam 2020-01-07 13:20:10 -08:00
parent 9c966c8b19
commit fed473ec00

View file

@ -366,8 +366,7 @@ export class ElementHandle<T extends Node = Node> extends js.JSHandle<T> {
return 'Cannot fill a disabled input.'; return 'Cannot fill a disabled input.';
if (input.readOnly) if (input.readOnly)
return 'Cannot fill a readonly input.'; return 'Cannot fill a readonly input.';
input.selectionStart = 0; input.select();
input.selectionEnd = input.value.length;
input.focus(); input.focus();
} else if (element.nodeName.toLowerCase() === 'textarea') { } else if (element.nodeName.toLowerCase() === 'textarea') {
const textarea = element as HTMLTextAreaElement; const textarea = element as HTMLTextAreaElement;