Repository navigation
Description
This tracks a temporary patch the fork carries in inputfiles/patches/dom.kdl. Remove it once browser-compat data catches up with the DOM spec. The patch fails silently: it won't break the build when it goes stale, so nothing else will remind us to remove it.
Problem
@webref/idl 3.87.0 picks up a DOM spec change. A new intermediate interface sits between AbstractRange and the concrete ranges, and the container attributes move into it:
[Exposed=Window]
interface AbstractRange {
readonly attribute unsigned long startOffset;
readonly attribute unsigned long endOffset;
readonly attribute boolean collapsed;
};
[Exposed=Window]
interface NodeRange : AbstractRange {
readonly attribute Node startContainer;
readonly attribute Node endContainer;
};
interface StaticRange : NodeRange { ... };
interface Range : NodeRange { ... };No browser ships NodeRange yet. @mdn/browser-compat-data 8.1.9 has no api.NodeRange entry and still records startContainer/endContainer under api.AbstractRange. The BCD filter therefore drops NodeRange, and the generated lib:
- declares
interface Range extends NodeRangeandinterface StaticRange extends NodeRangeagainst a type that doesn't exist (TS2304: Cannot find name 'NodeRange'), and - loses
startContainer/endContainerfromRange/StaticRange, because they're no longer onAbstractRange.
This first broke the 2026-11-14 weekly update (#35).
Fork fix
inputfiles/patches/dom.kdl keeps the shape browsers actually ship:
- re-adds
startContainer/endContainertoAbstractRange, with MDN URLs (MDN still documents them there); interface Range extends=AbstractRangeandinterface StaticRange extends=AbstractRange;removals { interface NodeRange }. Baseline cuts need this:applyReferenceClosureruns before patches, still seesRange : NodeRange, and would otherwise keepNodeRangeas an unused type-only interface in every cut.
The output for AbstractRange/Range/StaticRange is identical to the output before the IDL change.
Upstream status
Not checked. microsoft/TypeScript-DOM-lib-generator will hit the same failure when it updates to @webref/idl ≥ 3.87.0. If it patches this differently, prefer upstream's version so dom.kdl doesn't diverge at the next upstream merge.
How to check
- Does BCD have
api.NodeRangeyet?node -e 'const b=require("@mdn/browser-compat-data"); console.log(b.__meta.version, !!b.api.NodeRange, Object.keys(b.api.AbstractRange))' - Has upstream
inputfiles/patches/dom.kdl(orremovedTypes.jsonc/overridingTypes.jsonc) got its own handling forNodeRange? - Did the spec revert or rename
NodeRange? If@webref/idlno longer has it, the patch is a no-op and can simply go.
When it's time to remove
- BCD adds
api.NodeRange(browsers ship it): delete theAbstractRange/Range/StaticRangeblock and theinterface NodeRangeremoval fromdom.kdl. Otherwise the patch would wrongly strip a real, shipped interface and duplicate its members onAbstractRange. Then rebuild and reviewbaselines/plus every Baseline cut (npm run baseline-years). Older cuts whereNodeRangeisn't Baseline yet should get it back as a type-only interface through the reference closure. That's expected. - Upstream lands its own fix first: take upstream's version when merging and drop ours.
Close this issue once the patch is gone.
Activity
Link NodeRange patch to tracking issue #36
uhyo commentedon Nov 30, 2026
Upstream status (checked 2026-11-30, upstream
main@ f7effdf)Upstream landed its own fix. Upstream updated to
@webref/idl3.87.0 in 8859ea0 (microsoft#2605) and added a near-identical patch, but ininputfiles/patches/html.kdl, notdom.kdl:Upstream has no
removals { interface NodeRange }; nothing under upstreaminputfiles/removesNodeRangeexplicitly. Upstream's full lib doesn't need it because the BCD filter dropsNodeRange. Upstream'sbaselines/dom.generated.d.tshasRange/StaticRange extends AbstractRangeand noNodeRange. Upstream's comment says Blink supportsNodeRange, so BCD may addapi.NodeRangesoon. I did not run the BCD check from this issue.Next steps (from "When it's time to remove")
html.kdlversion and drop our duplicateAbstractRange/Range/StaticRangeblock fromdom.kdl. Otherwise both patches will add the same properties.removals { interface NodeRange }as fork-only (upstream doesn't have it). The Baseline cuts still need it becauseapplyReferenceClosureruns before patches. Then rebuild and reviewbaselines/plus every Baseline cut.api.NodeRange, upstream's patch and our remaining removal both need to go.Generated by Claude Code