core/caniuse silently drops the browser-support table when .head dl is missing
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 806
- Forks
- 434
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 32
Description
In src/core/caniuse.js, the browser-support table is appended with an optional-chaining call:
const headDlElem = document.querySelector(".head dl");
// ...
headDlElem?.append(...definitionPair.childNodes);
If .head dl is absent, the ?. swallows the failure and the module carries on, so the entire caniuse browser-support table is silently dropped. The author gets no warning that the feature they configured produced nothing.
The sibling module handles the same situation correctly. In src/core/implementation-status.js:
if (!headDlElem) return;
That returns early rather than continuing with work that cannot land anywhere.
Worth making caniuse either report the problem via showError/showWarning or return early the way implementation-status does, instead of failing silently.
Noted while upgrading TypeScript, which flagged a related unguarded querySelector result further down the same function. That guard is being fixed separately; this one is the pre-existing case and is not a regression.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/core/caniuse.js at the optional-chaining append and compare its missing-element handling with src/core/implementation-status.js. Check the existing error and warning helpers before choosing the appropriate behavior; done means an absent .head dl no longer silently drops the browser-support table.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100