Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

upgrade ES target to es2022#273

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
keithamus wants to merge1 commit intomain
base:main
Choose a base branch
Loading
fromupgrade-es-target-to-es2022

Conversation

keithamus
Copy link
Contributor

This upgrades the output to use ES2022. This includes native private fields syntax. We see almost zero devices on github.com that do not support private fields. And we've beenconsidered private fields part of our baseline support for a while now.

This means users on macos Mojave and below, using Safari, may have a further degraded experience than they already have. They can improve their experience by switching to another browser such as Chrome or Firefox, but Apple does not release Safari 15 for macos Mojave or below, as Apple has not supported macOS Mojave since Oct 2021 - when it was EOLd.

This also means users on ios/ipados 14 may see a further degraded experience. ios/ipados 14 was EOL in October 2021, and Apple no longer provides security updates for these devices. Some of these devices can upgrade to ios/ipados 15. Some devices, like the iPad Mini 3 (discontinued October 2014), 4th generation iPad (discontinued October 2014), or the iPhone 6 (discontinued September 2016) will be unable to upgrade to iOS 15, and so visiting a page with<relative-time> will cause JS toSyntaxError.

@keithamuskeithamus requested a review froma team as acode ownerFebruary 21, 2024 12:23
@silverwind
Copy link

silverwind commentedMar 13, 2024
edited
Loading

FWIW, I avoid private fields in all my code because ofthis. Not sure if it's really relevant to this element or whether consumers would install Proxies on it.

@keithamus
Copy link
ContributorAuthor

I'm not sure I share those opinions; if you're extending a class it's fairly common to have to override parts of the class to deal with things like private state or copying (see the whole@@species debacle). The alternatives to private fields are: make everything public (but then lose the ability to observe changes or have two public fields), or use a WeakMap, and then the loud errors about private field access turn into silent ones where properties using a WeakMap can return undefined instead.

@silverwind
Copy link

make everything public

I prefer all-public fields because they enable advanced use cases that the original author has not considered. For example, there are numerous cases in Node.js API where one needs to access underscore props. With private fields, you restrict the consumer too much imho.

@keithamus
Copy link
ContributorAuthor

Many of the private fields in this codebase (and our other custom element codebases) are public, but they need to be observed,for example#onRelativeTimeUpdated has a get/set but it has (warranted) side-effects which can only happen if we store the state under a different name. We could publicise the field name but that means coming up with some alternative name, and runs the risk of exposing undesirable information which can cause memory leaks - for example settingonRelativeTimeUpdated removes the old event listener, but if one were to assign to the#onRelativeTimeUpdated and not remove the old event listener, it would continue to fire and could cause further errors. We could make this field aWeakMap instead, but as I say, we then face the same issue with regard to subclassing, so I feel like this is a well justified use case where the alternatives have greater trade-offs.

@silverwind
Copy link

silverwind commentedMar 13, 2024
edited
Loading

Okay. I'm not suggesting changing these private fields now, but for new code, I would definitely consider using them and if there's no strong reason, I wouldn't, so that I don't breakProxy usage.

On topic: Another browser often forgotten is Pale Moon. Itlooks to support private class fields since their 2023-05-16 release, so I think it'll likely be fine with this change.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jonrohanjonrohanjonrohan approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@keithamus@silverwind@jonrohan

[8]ページ先頭

©2009-2025 Movatter.jp