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

ECMAScript discouraged/legacy feature #2564

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions features/javascript-discouraged.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: JavaScript built-ins (legacy)
description:
spec: https://tc39.es/ecma262/multipage/
group: javascript
discouraged:
according_to:
- https://tc39.es/ecma262/#sec-additional-ecmascript-features-for-web-browsers
- https://tc39.es/ecma262/#sec-object.prototype-legacy-accessor-methods
- https://tc39.es/ecma262/#sec-object.prototype.__proto__
compat_features:
# The following properties are legacy according to:
# https://tc39.es/ecma262/#sec-additional-ecmascript-features-for-web-browsers
- javascript.builtins.escape
- javascript.builtins.unescape
Comment on lines +13 to +14
Copy link
Collaborator

@ddbeck ddbeck Jan 22, 2025

Choose a reason for hiding this comment

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

I think breaking this out into a separate feature (something like "escape() and unescape()") would help us do better discouragement information. We don't have all the data for this yet (it'd be nice to reference an "internal" feature on javascript for encodeURIComponent() and friends) but I'm thinking ahead here about how a consumer like MDN might be able to use this data for useful developer content (as on the current MDN page).

- javascript.builtins.String.anchor
- javascript.builtins.String.big
- javascript.builtins.String.blink
- javascript.builtins.String.bold
- javascript.builtins.String.fixed
- javascript.builtins.String.fontcolor
- javascript.builtins.String.fontsize
- javascript.builtins.String.italics
- javascript.builtins.String.link
- javascript.builtins.String.small
- javascript.builtins.String.strike
- javascript.builtins.String.sub
- javascript.builtins.String.substr
- javascript.builtins.String.sup
Comment on lines +15 to +28
Copy link
Collaborator

Choose a reason for hiding this comment

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

These also look like they might work better as standalone HTML wrapper methods feature, an alternative being the dom feature.

- javascript.builtins.Date.getYear
- javascript.builtins.Date.setYear
Comment on lines +29 to +30
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess these two could make sense together as well.

- javascript.builtins.Date.toGMTString
- javascript.builtins.RegExp.compile

# The following properties are legacy according to:
# https://tc39.es/ecma262/#sec-object.prototype-legacy-accessor-methods
- javascript.builtins.Object.defineGetter
- javascript.builtins.Object.defineSetter
- javascript.builtins.Object.lookupGetter
- javascript.builtins.Object.lookupSetter
Comment on lines +34 to +39
Copy link
Collaborator

Choose a reason for hiding this comment

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

This one could be a "__defineGetter__() and __defineSetter__()" feature. For now it could have functions as an alternative, with the possibility of referencing an inner feature (get and set syntax) in the future.


# The following properties are legacy according to:
# https://tc39.es/ecma262/#sec-object.prototype.__proto__
- javascript.builtins.Object.proto
Copy link
Collaborator

Choose a reason for hiding this comment

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

Now that I've gotten to the end, I'm left with just a few miscellaneous, single-key items:

  • __proto__
  • RegExp.compile()
  • toGMTString

This isn't too bad? I'd be willing to tolerate having features for these, if it makes the consistency and shape of the other features mentioned above more legible.

69 changes: 69 additions & 0 deletions features/javascript-discouraged.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Generated from: javascript-discouraged.yml
# Do not edit this file by hand. Edit the source file instead!

status:
baseline: false
support:
chrome: "1"
chrome_android: "18"
edge: "12"
firefox: "1"
firefox_android: "4"
safari: "3.1"
safari_ios: "2"
compat_features:
# baseline: false
# support:
# chrome: "1"
# chrome_android: "18"
# edge: "12"
# firefox: "1"
# firefox_android: "4"
# safari: "1"
# safari_ios: "1"
- javascript.builtins.Date.getYear
- javascript.builtins.Date.setYear
- javascript.builtins.Date.toGMTString
- javascript.builtins.String.anchor
- javascript.builtins.String.big
- javascript.builtins.String.blink
- javascript.builtins.String.bold
- javascript.builtins.String.fixed
- javascript.builtins.String.fontcolor
- javascript.builtins.String.fontsize
- javascript.builtins.String.italics
- javascript.builtins.String.link
- javascript.builtins.String.small
- javascript.builtins.String.strike
- javascript.builtins.String.sub
- javascript.builtins.String.substr
- javascript.builtins.String.sup
- javascript.builtins.escape
- javascript.builtins.unescape

# baseline: false
# support:
# chrome: "1"
# chrome_android: "18"
# edge: "12"
# firefox: "1"
# firefox_android: "4"
# safari: "3"
# safari_ios: "1"
- javascript.builtins.Object.defineGetter
- javascript.builtins.Object.defineSetter
- javascript.builtins.Object.lookupGetter
- javascript.builtins.Object.lookupSetter
- javascript.builtins.Object.proto

# ⬇️ Same status as overall feature ⬇️
# baseline: false
# support:
# chrome: "1"
# chrome_android: "18"
# edge: "12"
# firefox: "1"
# firefox_android: "4"
# safari: "3.1"
# safari_ios: "2"
- javascript.builtins.RegExp.compile
Loading