From 0ed2641b7076fe44cbaacddf72af051cb3dcd21e Mon Sep 17 00:00:00 2001 From: Andria Brown Date: Sat, 11 May 2024 16:16:23 -0600 Subject: [PATCH] cloneNode returns this (not Node) The `cloneNode` return type is incorrect. The type before this change indicated that `cloneNode` returned a `Node`, which then broke any class that extended `Node`. In reality, `cloneNode` will return an instance of whatever the current class type is, a.k.a. `this` (`DocumentFragment#cloneNode` returns a `DocumentFragment`, not a `Node`). --- baselines/dom.generated.d.ts | 2 +- inputfiles/overridingTypes.jsonc | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index 0ee8a118e..e0e2db495 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -16450,7 +16450,7 @@ interface Node extends EventTarget { * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/cloneNode) */ - cloneNode(deep?: boolean): Node; + cloneNode(deep?: boolean): this; /** * Returns a bitmask indicating the position of other relative to node. * diff --git a/inputfiles/overridingTypes.jsonc b/inputfiles/overridingTypes.jsonc index 416f88377..fdc39956f 100644 --- a/inputfiles/overridingTypes.jsonc +++ b/inputfiles/overridingTypes.jsonc @@ -846,6 +846,19 @@ } } }, + "cloneNode": { + "signature": { + "0": { + "param": [ + { + "name": "deep", + "overrideType": "boolean" + } + ], + "overrideType": "this" + } + } + }, "removeChild": { "signature": { "0": {