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

no more vars in Web/API (2) #18864

Merged
merged 6 commits into from
Jul 28, 2022
Merged

no more vars in Web/API (2) #18864

merged 6 commits into from
Jul 28, 2022

Conversation

lionralfs
Copy link
Contributor

Summary

Replaces var in Web/API with const where applicable and let otherwise.
Mostly automated via my ESLint setup, using the rules no-var and prefer-const

Motivation

Metadata

  • Adds a new document
  • Rewrites (or significantly expands) a document
  • Fixes a typo, bug, or other error

* See mdn#16662
* See #10389
* See https://github.com/orgs/mdn/discussions/143
* Mostly automated via my ESLint setup, using the rules 'no-var' and 'prefer-const'
@lionralfs lionralfs requested a review from a team as a code owner July 27, 2022 21:36
@lionralfs lionralfs requested review from wbamberg and removed request for a team July 27, 2022 21:36
@github-actions github-actions bot added the Content:WebAPI Web API docs label Jul 27, 2022
@github-actions

This comment was marked as resolved.

files/en-us/web/api/contactsmanager/getproperties/index.md Outdated Show resolved Hide resolved
files/en-us/web/api/cssstylesheet/insertrule/index.md Outdated Show resolved Hide resolved
files/en-us/web/api/document/lastmodified/index.md Outdated Show resolved Hide resolved
@@ -47,7 +47,7 @@ None ({{jsxref("undefined")}}).
Here is a very simple example:

```js
var Mytag = document.registerElement('my-tag');
const Mytag = document.registerElement('my-tag');
Copy link
Contributor

@rubiesonthesky rubiesonthesky Jul 27, 2022

Choose a reason for hiding this comment

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

Suggested change
const Mytag = document.registerElement('my-tag');
const myTag = document.registerElement('my-tag');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this should stay the way it is, the following section reads:

Now the new tag is registered in the browser. The Mytag variable holds a
constructor that you can use to create a my-tag element in the document as
follows:

document.body.appendChild(new Mytag());

files/en-us/web/api/baseaudiocontext/currenttime/index.md Outdated Show resolved Hide resolved
files/en-us/web/api/baseaudiocontext/destination/index.md Outdated Show resolved Hide resolved
files/en-us/web/api/baseaudiocontext/listener/index.md Outdated Show resolved Hide resolved
files/en-us/web/api/baseaudiocontext/samplerate/index.md Outdated Show resolved Hide resolved
files/en-us/web/api/biquadfilternode/detune/index.md Outdated Show resolved Hide resolved
files/en-us/web/api/clipboarditem/gettype/index.md Outdated Show resolved Hide resolved
files/en-us/web/api/contactsmanager/getproperties/index.md Outdated Show resolved Hide resolved
@lionralfs lionralfs requested a review from teoli2003 July 28, 2022 10:45
Copy link
Contributor

@teoli2003 teoli2003 left a comment

Choose a reason for hiding this comment

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

👍

@teoli2003 teoli2003 merged commit 49b07e5 into mdn:main Jul 28, 2022
@lionralfs lionralfs deleted the no-var-2 branch July 28, 2022 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants