emscripten-core / emscripten-core/emscripten

findCanvasEventTarget doesn't use specialHTMLTargets

Open
#22,942 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Please include the following in your bug report:

**Version of emscripten/emsdk:**
```
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.71 (4171ae200b77a6c266b0e1ebb507d61d1ade3501)
clang version 20.0.0git (https:/github.com/llvm/llvm-project d6344c1cd0d099f8d99ee320f33fc9254dbe8288)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /home/jcoa2018/.local/src/emsdk/upstream/bin
```

This line in `library_html5.js`:

https://github.com/emscripten-core/emscripten/blob/f0cc3d004bcbc29a4a5421d54e884d4c42b05218/src/library_html5.js#L366

Seems like it should fall back to findEventTarget, not manual document querying/ID lookup. At a minimum, it should check `specialHTMLTargets[target]` as well as the other options.

Right now, if you follow the docs and call your canvas e.g. "!canvas" in specialHTMLTargets, createContext seemingly won't be able to find it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.