ampproject / ampproject/worker-dom

HTMLInputElement.select() not working

Open
#779 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3.3k
Forks
154
PR merge metrics
No merged PRs in 30d

Description

web_compat_table.md says that select() is working, but that seems to be incorrect.

This is **working**:

```
var inputTextEl = document.getElementById("inputID");

inputTextEl.addEventListener('click', function myFunction(event) {
event.target.value = "value changed";
});

```
This is **not working**:

```
var inputTextEl = document.getElementById("inputID");

inputTextEl.addEventListener('click', function myFunction(event) {
event.target.select();
});

```
Console says: **Uncaught TypeError: event.target.select is not a function**
Would been nice with a working select function.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing web_compat_table.md and reproducing the reported click-handler example to confirm the current behavior. Then locate the HTMLInputElement implementation and its relevant tests; done means calling event.target.select() no longer raises the reported TypeError and the input text is selected.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.