Simplify / fix HTMLCollection overrides#813
Simplify / fix HTMLCollection overrides#813RReverser wants to merge 2 commits intomicrosoft:mainfrom
Conversation
|
I came across this while implementing #222, but decided it's worthwile to separate out this refactoring into its own PR as it's not strictly related to that issue. |
| new(): HTMLCollection; | ||
| }; | ||
|
|
||
| interface HTMLCollectionOf<T extends Element> extends HTMLCollectionBase { |
There was a problem hiding this comment.
I and probably other people have used it in own code (API which should usable with getElementsByTagNameNS output for example.
So this interface should probably survive with a @deprecated tag.
There was a problem hiding this comment.
The interface name also is consistent with NodeListOf.
There was a problem hiding this comment.
Added a deprecated HTMLCollectionOf alias for backwards compatibility. @saschanaz should I maybe do the same for NodeListOf then for consistency?
There was a problem hiding this comment.
I don't have a strong opinion here, maybe @sandersn ?
Use an extra optional type param on HTMLCollection for `namedItem` override. This simplifies / removes quite a lot of emitter code that was necessary to maintain just for this override. Instead, this PR is using regular backward-compatible type system capabilities. As an additional benefit, this removes a phantom HTMLCollectionOf class that previously appeared as a valid global, but doesn't really exist in JavaScript global object.
550a6a7 to
a2a424a
Compare
a2a424a to
8bca275
Compare
|
Revisiting this after 2 years... 😅 Now that I have a permission to merge, I find this beneficial with no regression. Could you try rebasing? I can cherry-pick this PR if you are too busy. Thank you! |
|
Lol it's been a while, yeah 😅 If you could rebase on your side, that would be great, yeah. |
|
Can I create a new PR for this @saschanaz |
|
Please go ahead. |
Use an extra optional type param on HTMLCollection for
namedItemoverride.This simplifies / removes quite a lot of emitter code that was necessary to maintain just for this override.
Instead, this PR is using regular backward-compatible type system capabilities.
As an additional benefit, this removes a phantom HTMLCollectionOf class that previously appeared as a valid global, but doesn't really exist in JavaScript global object.