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
16 changes: 16 additions & 0 deletions features/accessor-methods.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Accessor methods
description: The `__defineGetter__()` and `__defineSetter__()` methods of objects bind a function to a property, which is called on setting or reading the property.
spec: https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.prototype-legacy-accessor-methods
discouraged:
according_to:
- https://tc39.es/ecma262/multipage/additional-ecmascript-features-for-web-browsers.html#sec-additional-ecmascript-features-for-web-browsers
# No `alternatives` because 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.

# internal reference to the object defineProperty method and the function
# get/set syntax.
# See: https://github.com/web-platform-dx/web-features/issues/2676
compat_features:
- javascript.builtins.Object.defineGetter
- javascript.builtins.Object.defineSetter
- javascript.builtins.Object.lookupGetter
- javascript.builtins.Object.lookupSetter
18 changes: 18 additions & 0 deletions features/accessor-methods.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated from: accessor-methods.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"
safari_ios: "1"
compat_features:
- javascript.builtins.Object.defineGetter
- javascript.builtins.Object.defineSetter
- javascript.builtins.Object.lookupGetter
- javascript.builtins.Object.lookupSetter
14 changes: 14 additions & 0 deletions features/date-get-year-set-year.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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.

spec: https://tc39.es/ecma262/multipage/additional-ecmascript-features-for-web-browsers.html#sec-date.prototype.getyear
group: javascript
discouraged:
according_to:
- https://tc39.es/ecma262/multipage/additional-ecmascript-features-for-web-browsers.html#sec-additional-ecmascript-features-for-web-browsers
# No `alternatives` because it would be `alternatives: [date]`. In the future
# it'd be nice to have an internal reference to getFullYear() and
# setFullYear() instead.
# See: https://github.com/web-platform-dx/web-features/issues/2676
compat_features:
- javascript.builtins.Date.getYear
- javascript.builtins.Date.setYear
16 changes: 16 additions & 0 deletions features/date-get-year-set-year.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Generated from: date-get-year-set-year.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: "1"
safari_ios: "1"
compat_features:
- javascript.builtins.Date.getYear
- javascript.builtins.Date.setYear
12 changes: 12 additions & 0 deletions features/date-to-gmt-string.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: toGMTString()
description: The `toGMTSTring()` method of `Date` objects is an alias to the `toUTCString()` method.
spec: https://tc39.es/ecma262/multipage/additional-ecmascript-features-for-web-browsers.html#sec-date.prototype.togmtstring
discouraged:
according_to:
- https://tc39.es/ecma262/multipage/additional-ecmascript-features-for-web-browsers.html#sec-additional-ecmascript-features-for-web-browsers
# No `alternatives` because it would be `alternatives: [date]`. In the future
# it'd be nice to have an internal reference to the `toUTCString()` method
# instead.
# See: https://github.com/web-platform-dx/web-features/issues/2676
compat_features:
- javascript.builtins.Date.toGMTString
15 changes: 15 additions & 0 deletions features/date-to-gmt-string.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Generated from: date-to-gmt-string.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: "1"
safari_ios: "1"
compat_features:
- javascript.builtins.Date.toGMTString
14 changes: 14 additions & 0 deletions features/escape-unescape.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: escape() and unescape()
description: The `escape()` and `unescape()` built-in Javascript methods encode and unencode strings using percent encoding, where certain characters are replaced by hexidecimal escape sequences.
spec: https://tc39.es/ecma262/multipage/additional-ecmascript-features-for-web-browsers.html#sec-escape-string
group: javascript
discouraged:
according_to:
- https://tc39.es/ecma262/multipage/additional-ecmascript-features-for-web-browsers.html#sec-additional-ecmascript-features-for-web-browsers
# No `alternatives` because it would be `alternatives: [javascript]`. In the
# future it'd be nice to have an internal reference to encodeURI(),
# decodeURI(), encodeURIComponent(), and decodeURIComponent() instead.
# See: https://github.com/web-platform-dx/web-features/issues/2676
compat_features:
- javascript.builtins.escape
- javascript.builtins.unescape
16 changes: 16 additions & 0 deletions features/escape-unescape.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Generated from: escape-unescape.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: "1"
safari_ios: "1"
compat_features:
- javascript.builtins.escape
- javascript.builtins.unescape
24 changes: 24 additions & 0 deletions features/html-wrapper-methods.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: HTML wrapper methods
description: JavaScript built-in methods such as, `String.bold()` and `String.italics()`, wrap strings in (often historic) HTML.
spec: https://tc39.es/ecma262/multipage/additional-ecmascript-features-for-web-browsers.html#sec-additional-properties-of-the-string.prototype-object
group: javascript
discouraged:
according_to:
- https://tc39.es/ecma262/multipage/additional-ecmascript-features-for-web-browsers.html#sec-additional-ecmascript-features-for-web-browsers
alternatives:
- dom
compat_features:
- 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
28 changes: 28 additions & 0 deletions features/html-wrapper-methods.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated from: html-wrapper-methods.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: "1"
safari_ios: "1"
compat_features:
- 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
12 changes: 12 additions & 0 deletions features/proto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: __proto__
description: The `__proto__` property of objects partially exposes the prototype of an object.
spec: https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.prototype.__proto__
discouraged:
according_to:
- https://tc39.es/ecma262/multipage/additional-ecmascript-features-for-web-browsers.html#sec-additional-ecmascript-features-for-web-browsers
# No `alternatives` because it would be `alternatives: [object]`. In the
# future it'd be nice to have an internal reference to `getPrototypeOf()` and
# `setPrototypeOf()` instead.
# See: https://github.com/web-platform-dx/web-features/issues/2676
compat_features:
- javascript.builtins.Object.proto
15 changes: 15 additions & 0 deletions features/proto.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Generated from: proto.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"
safari_ios: "1"
compat_features:
- javascript.builtins.Object.proto
12 changes: 12 additions & 0 deletions features/regexp-compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: RegExp compile()
description: The `compile()` method of `RegExp` objects recompiles an existing regular expression object using a new pattern and flags.
spec: https://tc39.es/ecma262/multipage/additional-ecmascript-features-for-web-browsers.html#sec-regexp.prototype.compile
discouraged:
according_to:
- https://tc39.es/ecma262/multipage/additional-ecmascript-features-for-web-browsers.html#sec-additional-ecmascript-features-for-web-browsers
# No `alternatives` because it would be `alternatives: [regexp]`. In the
# future it'd be nice to have an internal reference to the RegExp()
# constructor instead.
# See: https://github.com/web-platform-dx/web-features/issues/2676
compat_features:
- javascript.builtins.RegExp.compile
15 changes: 15 additions & 0 deletions features/regexp-compile.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Generated from: regexp-compile.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:
- javascript.builtins.RegExp.compile