Skip to content
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

Add several discouraged JavaScript features #2670

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

ddbeck
Copy link
Collaborator

@ddbeck ddbeck commented Feb 18, 2025

This PR adds several discouraged JavaScript features, building on @captainbrosset's work in #2564. The features are:

  • Accessor methods (__defineGetter__() and __defineSetter__())
  • Date.prototype.{get,set}Year()
  • Date.prototype.toGMTString()
  • escape() and unescape() global methods
  • HTML wrapper methods (e.g., String.prototype.blink())
  • Object.prototype.__proto__
  • RegExp.prototype.compile()

Supersedes and closes #2564.

@github-actions github-actions bot added the feature definition Creating or defining new features or groups of features. label Feb 18, 2025
Copy link
Contributor

@captainbrosset captainbrosset left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few comments.

according_to:
- https://tc39.es/ecma262/multipage/additional-ecmascript-features-for-web-browsers.html#sec-additional-ecmascript-features-for-web-browsers
# No `alternatives` becuase it would be `alternatives:
# [object-object, functions]`. In the future it'd be nice to have an
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you open an issue about this? It'd be nice to track this. I agree that being able to deep-link into existing features would be useful.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed #2676 and added links to the comments with 7ee30da.

@@ -0,0 +1,13 @@
name: getYear() and setYear()
description: The `getYear()` and `setYear()` methods of `Date` objects get and set the year offset to 1900, changing a date's year in way that is subject to the year 2000 problem.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: The `getYear()` and `setYear()` methods of `Date` objects get and set the year offset to 1900, changing a date's year in way that is subject to the year 2000 problem.
description: The `getYear()` and `setYear()` methods of `Date` objects get and set the year offset to 1900, changing a date's year in a way that is subject to the year 2000 problem.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if "the year 2000 problem" is showing our age a little bit :)
Joking aside, I wonder how many people who read this going forward will actually know what it refers to.

Copy link
Collaborator Author

@ddbeck ddbeck Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good point. Really, that's information more suited to a (probable future) discouragement reason field. How about this more matter-of-fact version?

Suggested change
description: The `getYear()` and `setYear()` methods of `Date` objects get and set the year offset to 1900, changing a date's year in way that is subject to the year 2000 problem.
description: The `getYear()` and `setYear()` methods of `Date` objects get and set the year as an offset to 1900.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature definition Creating or defining new features or groups of features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants