speced / speced/respec

core/caniuse silently drops the browser-support table when .head dl is missing

Open Beginner friendly
#5,370 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.