Skip to content

Provide lib for modern DOM #21150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jods4 opened this issue Jan 11, 2018 · 6 comments
Open

Provide lib for modern DOM #21150

jods4 opened this issue Jan 11, 2018 · 6 comments
Labels
Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Experience Enhancement Noncontroversial enhancements Help Wanted You can do this Suggestion An idea for TypeScript
Milestone

Comments

@jods4
Copy link

jods4 commented Jan 11, 2018

This is basically a re-opening of #2910, which @mhegazy asked me to do.

Nowadays TS has the lib compiler option that allow users to selectively choose which core definitions to include or not based on their target.

It would be nice to add a new option similar to dom and dom.iterable for users targetting a modern DOM runtime. Not sure how to name this since W3C has moved from releases to a "living standard" model.

For example, the living standard includes interfaces ChildNode with methods after, before, remove and replaceWith; ParentNode with methods prepend and append.

Those methods have been in Firefox and Chrome for a long while, they're in preview in Edge (17035+).

They are very convenient and there's no reason a dev that targets modern browsers shouldn't be able to do "lib": "dom.living" and use them.

Unfortunately I am not sure if there's a list somewhere of all those new features... except going through the whole standard :(

@mhegazy
Copy link
Contributor

mhegazy commented Jan 11, 2018

We have been more open in taking in these declarations into lib.d.ts. so feel free to send us a PR adding the new interfaces.
You can find more information about contributing lib.d.ts fixes at https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md#contributing-libdts-fixes.

@mhegazy mhegazy added Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Help Wanted You can do this labels Jan 11, 2018
@mhegazy mhegazy added this to the Community milestone Jan 11, 2018
@JoshuaKGoldberg
Copy link
Contributor

@jods4
Copy link
Author

jods4 commented May 31, 2018

My understanding is that the basis used to generated DOM lib is the MS Edge definitions.
Since those features have shipped (see
https://twitter.com/MSEdgeUpdates/status/1000421335229784064
) can we expect to see them in the next TS release?
I hoped they would be in 2.9, too bad they're not :(

@mhegazy
Copy link
Contributor

mhegazy commented Jun 3, 2018

We are moving to generate the lib from the spec directelly. See https://github.com/Microsoft/TSJS-lib-generator/tree/master/inputfiles/idl

@jods4
Copy link
Author

jods4 commented Jun 4, 2018

👍 that would fix it as well!

chharvey pushed a commit to chharvey/extrajs-dom that referenced this issue Jul 18, 2018
@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript Experience Enhancement Noncontroversial enhancements labels Oct 18, 2018
@chharvey
Copy link

chharvey commented Nov 2, 2018

I noticed TypeScript v3.1 introduced a lot of new DOM functionality, including (among the most common):

  • ChildNode#after()
  • ChildNode#before()
  • ChildNode#replaceWith()
  • ParentNode#append()
  • ParentNode#prepend()

The release notes indicate that part of lib.d.ts is now generated programmatically from the WHATWG DOM Spec. 🎊

@RyanCavanaugh RyanCavanaugh modified the milestones: Community, Backlog Mar 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Experience Enhancement Noncontroversial enhancements Help Wanted You can do this Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

5 participants