PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, October 15, 2022

[FIXED] Why is dom and dom.iterable seperate?

 October 15, 2022     dom, javascript, tsconfig, typescript     No comments   

Issue

In tsconfig.json you can define additional libs, that give you typings for HTML or DOM "libraries"(? I don't know the correct terminology).

I don't understand why dom and dom.iterable are separate. Were they defined in different ecma modules/versions? Can I use them safely?


Solution

I suspect it's because iteration (iterables and iterators) weren't added to JavaScript until ES2015, long after TypeScript was well-established. When ES2015 was released, the JavaScript engines in many browsers didn't support iteration (yet),¹ and of course at the time Internet Explorer was still a...thing...that was never going to get new features. So some projects had to target environments that didn't have iteration, so the libs are separate.

Even here in 2022, IE survives in corporate and government installations (although thankfully that's finally changing), and some folks have to target their apps and pages to those environments, so they wouldn't want to use dom.iterable.


¹ ES2015 was the last version of the specification to include significant features that didn't already have implementations in the field. These days, the process that TC39 follows generally doesn't land features in the spec until there are (ideally) a couple of implementations of the feature shipping in the field. Instead, the proposal stays at Stage 3 until that happens, before being moved to Stage 4 by consensus at a TC39 meeting, being added to the editor's draft, and thus being in the next snapshot specification the following June.



Answered By - T.J. Crowder
Answer Checked By - Timothy Miller (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing