-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Incomplete iterable DOM changes for discussion #249
Conversation
82a663d
to
49e362e
Compare
Thanks! Sorry, I missed your comment in this discussion. If it should be added by Web IDL - we should add it. I'll check docs when I'll have time. Removing methods is a breaking change, but anyway, I want to work on a major release. |
Yeah, wasn't sure what your thoughts were on that |
49e362e
to
9ecd6d1
Compare
Yep.
Most likely it would be problematic - too many breaking changes in proposals and I wanted to add some breaking changes to API. So most likely it's for |
@zloirock Could you give me some pointers on the filesystem structure? I'm confused about why there are three files
The last two add NAME to |
It's for global polyfill.
It's for the version without global namespace pollution if it's deferred from the global version.
It's final So you should change the first 2 and add tests if it's not hard. |
Ah okay, For the logic in modules/library/web.dom.iterable, how does it affect iterability of the globals? Is there internal logic somewhere else? |
It uses |
...and looks like that in one case I forgot to add one additional check for |
9ecd6d1
to
1cbf2fe
Compare
1cbf2fe
to
5eb083e
Compare
@zloirock I assume I'm doing something dumb, mind taking a look and telling me why these tests are failing now? |
@zloirock Thoughts? |
@loganfsmyth sorry, I had some problems with time and I missed your message. I'll check it in the evening. |
No rush, I figured it had gotten lost. |
TextTrackCueList: false, | ||
TextTrackList: false, | ||
TouchList: false | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In library
version, we don't need keys
/ values
/ entries
methods, so we can replace it with an array and get rid of _object-keys
dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I was on the fence, I figured keeping the two implementations similar was better but totally your call.
Looks like the problem that |
Summary: These DOM properties are definitely nullable, though in the average case they probably exist. I assume it's best for the type definitions to cover all the possibilities. For the iterability, Chome added these in a few releases ago and the next release of core-js should include polyfill logic for them. More info in zloirock/core-js#249 Closes #3127 Differential Revision: D4388268 Pulled By: gabelevi fbshipit-source-id: 282238b38f82fb71db87f88eb7f9583c20286724
Posting for discussion given babel/babel#4616. Not a complete fix because I wanted to get your thoughts before going further.
As far as I can tell, and given the behavior in Chrome and FF, these are supposed to be iterable because of the behavior documented in https://heycam.github.io/webidl/#es-iterators for IDL. It says any integer-indexed class should be considered iterable automatically, but only those explicitly marked
Iterable
in the IDL should getkeys
,values
andentries
.Given that, the current behavior of of MediaList, StyleSheetList, and CSSRuleList aren't quite right since they should not have an
.keys
,.values
and.entries
. Only NodeList and DOMTokenList are explicitlyIterable<>
in the DOM spec.I've pulled in a list of DOM classes that are currently iterable in Chrome/FF and merged them together with a bit of cleanup. This covers HTMLCollection and NamedNodeMap, which are probably the main important ones people are likely to want to use.