Skip to content

Commit

Permalink
Merge branch 'main' into fenced-frames
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdavidmills authored Jul 25, 2023
2 parents 31570cc + 9894531 commit efac47f
Show file tree
Hide file tree
Showing 313 changed files with 878 additions and 554 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/pr-check_markdownlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,3 @@ jobs:
yarn markdownlint-cli2 ${files_to_lint}
echo "Linting front-matter"
node scripts/front-matter_linter.js ${files_to_lint}
- name: Prettier markdown files
run: |
files_to_lint="${{ env.DIFF_DOCUMENTS }}"
yarn prettier -c ${files_to_lint}
2 changes: 1 addition & 1 deletion .markdownlint-cli2.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -211,5 +211,5 @@
}
},
"customRules": ["markdownlint-rule-search-replace"],
"ignores": ["node_modules", ".github", "tests"]
"ignores": ["node_modules", ".git", ".github", "tests"]
}
25 changes: 19 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,22 +147,29 @@ To fork and clone the repository:
The previous sections describe how to get started using the GitHub UI to make small changes to a single file and how to create a fork and clone the repository to prepare for making larger changes.
This section describes how to build the project locally and how to prepare your changes for submission.

### Installing and running the project
### Preparing the project

To set up the site locally, you need to have [Node.js](https://nodejs.org/) and [Yarn](https://yarnpkg.com/) installed.
To serve the site locally, you need to have [Node.js](https://nodejs.org/) and [Yarn 1 (Classic)](https://classic.yarnpkg.com/) installed.
You can check if these are installed by running the following commands:

```bash
node -v
yarn -v
```

After you have installed Node.js and Yarn, you can install the dependencies using `yarn` and start the local preview:
After you have installed Node.js and Yarn, you can install the dependencies using `yarn`:

```bash
# Assuming your fork is in ~/repos/content
cd ~/repos/content
yarn
```

### Running the project

After you have installed all dependencies, you can start the local preview using `yarn start`:

```bash
yarn start
```

Expand All @@ -184,9 +191,7 @@ To edit files and track your changes, you should use feature branches.
Feature branches are created from the `main` branch and should be named after the feature you're working on.
This will make it easier to submit a pull request for your changes.
> **Note**
> Open a discussion if your changes will contain large, complex or structural changes.
> Ask for feedback before embarking on large tasks.
> **Note:** Open a discussion if your changes will contain large, complex or structural changes. Ask for feedback before embarking on large tasks.
1. When the server is running, make the changes you would like to make to one or more `index.md` files.
Expand All @@ -212,6 +217,14 @@ This will make it easier to submit a pull request for your changes.
# or "git push --set-upstream origin fix-typo" if you haven't pushed this branch before
```
#### Linting edited files
To ensure that all MDN documents follow the same formatting, we use both [Prettier](https://www.prettier.io) and [Markdownlint](https://github.com/DavidAnson/markdownlint) to format and lint Markdown files. This helps us enforce uniform styling across all documents with minimal reviewer intervention.
If you have a [local checkout](#forking-and-cloning-the-repository) of the repository and have [installed the dependencies](#preparing-the-project), or you are using [github.dev](https://github.dev), a pre-commit hook will be installed which automatically runs while making a commit. To save some headache and improve your work flow while authoring, you may wish to [configure your editor to automatically run Prettier](https://prettier.io/docs/en/editors.html). Alternatively, you may run `yarn fix:md` in the command line to manually format all Markdown files.
> **Note:** Automatically formatting changes does not work for pull requests opened using the GitHub Web UI as described in the ["Simple changes" section](#simple-changes). This may result in failed status checks on pull requests. If you're not sure about how to fix this, [get in touch with us](https://developer.mozilla.org/en-US/docs/MDN/Community/Communication_channels) for help.
### Adding a new document
Adding a new document is relatively straightforward, especially if you can start by copying the `index.md` of a similar document.
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/_redirects.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9616,7 +9616,7 @@
/en-US/docs/Web/API/Screen.unlockOrientation /en-US/docs/Web/API/Screen/unlockOrientation
/en-US/docs/Web/API/Screen.width /en-US/docs/Web/API/Screen/width
/en-US/docs/Web/API/Screen/onorientationchange /en-US/docs/Web/API/Screen/orientationchange_event
/en-US/docs/Web/API/ScreenOrientation/onchange /en-US/docs/Web/API/ScreenOrientation
/en-US/docs/Web/API/ScreenOrientation/onchange /en-US/docs/Web/API/ScreenOrientation/change_event
/en-US/docs/Web/API/ScriptProcessorNode.bufferSize /en-US/docs/Web/API/ScriptProcessorNode/bufferSize
/en-US/docs/Web/API/ScriptProcessorNode.onaudioprocess /en-US/docs/Web/API/ScriptProcessorNode/audioprocess_event
/en-US/docs/Web/API/ScriptProcessorNode/audioprocess /en-US/docs/Web/API/ScriptProcessorNode/audioprocess_event
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/glossary/dns/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ page-type: glossary-definition

**DNS** (Domain Name System) is a hierarchical and decentralized naming system for Internet connected resources. DNS maintains a list of {{Glossary("domain name","domain names")}} along with the resources, such as IP addresses, that are associated with them.

The most prominent function of DNS is the translation of human-friendly domain names (such as mozilla.org) to a numeric {{Glossary("IP address")}} (such as 151.106.5.172); this process of mapping a domain name to the appropriate IP address is known as a **DNS lookup**. By contrast, a **reverse DNS lookup** (rDNS) is used to determine the domain name associated with an IP address.
The most prominent function of DNS is the translation of human-friendly domain names (such as mozilla.org) to a numeric {{Glossary("IP address")}} (such as 192.0.2.172); this process of mapping a domain name to the appropriate IP address is known as a **DNS lookup**. By contrast, a **reverse DNS lookup** (rDNS) is used to determine the domain name associated with an IP address.

## See also

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ So we are connected to the telephone infrastructure. The next step is to send th

### Finding computers

If you want to send a message to a computer, you have to specify which one. Thus any computer linked to a network has a unique address that identifies it, called an "IP address" (where IP stands for _Internet Protocol_). It's an address made of a series of four numbers separated by dots, for example: `192.168.2.10`.
If you want to send a message to a computer, you have to specify which one. Thus any computer linked to a network has a unique address that identifies it, called an "IP address" (where IP stands for _Internet Protocol_). It's an address made of a series of four numbers separated by dots, for example: `192.0.2.172`.

That's perfectly fine for computers, but we human beings have a hard time remembering that sort of address. To make things easier, we can alias an IP address with a human-readable name called a _domain name_. For example (at the time of writing; IP addresses can change) `google.com` is the domain name used on top of the IP address `142.250.190.78`. So using the domain name is the easiest way for us to reach a computer over the Internet.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ page-type: learn-faq

Domain names are a key part of the Internet infrastructure. They provide a human-readable address for any web server available on the Internet.

Any Internet-connected computer can be reached through a public {{Glossary("IP Address")}}, either an IPv4 address (e.g. `173.194.121.32`) or an IPv6 address (e.g., `2027:0da8:8b73:0000:0000:8a2e:0370:1337`).
Any Internet-connected computer can be reached through a public {{Glossary("IP Address")}}, either an IPv4 address (e.g. `192.0.2.172`) or an IPv6 address (e.g., `2001:db8:8b73:0000:0000:8a2e:0370:1337`).

Computers can handle such addresses easily, but people have a hard time finding out who is running the server or what service the website offers. IP addresses are hard to remember and might change over time.

Expand Down
32 changes: 20 additions & 12 deletions files/en-us/learn/forms/how_to_build_custom_form_controls/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ The required styles are those necessary to handle the three states of our contro
```css
.select {
/* This will create a positioning context for the list of options;
adding this to .select{{cssxref(':focus-within')}} will be a better option when fully supported
adding this to `.select:focus-within` will be a better option when fully supported
*/
position: relative;

Expand All @@ -136,7 +136,7 @@ We need an extra class `active` to define the look and feel of our control when
.select:focus {
outline: none;

/* This {{cssxref('box-shadow')}} property is not exactly required, however it's imperative to ensure
/* This box-shadow property is not exactly required, however it's imperative to ensure
active state is visible, especially to keyboard users, that we use it as a default value. */
box-shadow: 0 0 3px 1px #227755;
}
Expand Down Expand Up @@ -176,7 +176,7 @@ So now that we have the basic functionality in place, the fun can start. The fol
```css
.select {
/* The computations are made assuming 1em equals 16px which is the default value in most browsers.
If you are lost with px to em conversion, try http://riddle.pl/emcalc/ */
If you are lost with px to em conversion, try https://nekocalc.com/px-to-em-converter */
font-size: 0.625em; /* this (10px) is the new font size context for em value in this context */
font-family: Verdana, Arial, sans-serif;

Expand Down Expand Up @@ -661,7 +661,7 @@ Before starting, it's important to remember **JavaScript in the browser is an un
- The script did not load: This is one of the most common cases, especially in the mobile world where the network is not very reliable.
- The script is buggy: You should always consider this possibility.
- The script conflicts with a third-party script: This can happen with tracking scripts or any bookmarklets the user uses.
- The script conflicts with, or is affected by, a browser extension (such as Firefox's [NoScript](https://addons.mozilla.org/fr/firefox/addon/noscript/) extension) or Chrome's [ScriptBlock](https://chrome.google.com/webstore/detail/scriptblock/hcdjknjpbnhdoabbngpmfekaecnpajba).
- The script conflicts with, or is affected by, a browser extension (such as Firefox's [NoScript](https://addons.mozilla.org/fr/firefox/addon/noscript/) extension or Chrome's [ScriptBlock](https://chrome.google.com/webstore/detail/scriptblock/hcdjknjpbnhdoabbngpmfekaecnpajba) extension).
- The user is using a legacy browser, and one of the features you require is not supported: This will happen frequently when you make use of cutting-edge APIs.
- The user is interacting with the content before the JavaScript has been fully downloaded, parsed, and executed.

Expand Down Expand Up @@ -704,7 +704,7 @@ Second, we need two new classes to let us hide the unneeded element: we visually
.widget select,
.no-widget .select {
/* This CSS selector basically says:
- either we have set the body class to "widget" and thus we hide the actual {{HTMLElement("select")}} element
- either we have set the body class to "widget" and thus we hide the actual <select> element
- or we have not changed the body class, therefore the body class is still "no-widget",
so the elements whose class is "select" must be hidden */
position: absolute;
Expand Down Expand Up @@ -1380,7 +1380,11 @@ window.addEventListener("load", () => {

In the code above, it's worth noting the use of the [`tabIndex`](/en-US/docs/Web/API/HTMLElement/tabIndex) property. Using this property is necessary to ensure that the native control will never gain focus, and to make sure that our custom control gains focus when the user uses their keyboard or mouse.

With that, we're done! Here's the result ([check out the source code here](/en-US/docs/Learn/Forms/How_to_build_custom_form_controls/Example_4)):
With that, we're done!

#### Live example

Check out the [source code here](/en-US/docs/Learn/Forms/How_to_build_custom_form_controls/Example_4).

```html hidden
<form class="no-widget">
Expand Down Expand Up @@ -1637,7 +1641,7 @@ window.addEventListener("load", () => {
});
```

{{EmbedLiveSample("Handling_the_controls_value",120,130)}}
{{EmbedLiveSample("live_example_2",120,130)}}

But wait a second, are we really done?

Expand Down Expand Up @@ -1701,7 +1705,11 @@ function updateValue(select, index) {

It might have seemed simpler to let a screen reader focus on the off-screen select and ignore our stylized one, but this is not an accessible solution. Screen readers are not limited to blind people; people with low vision and even perfect vision use them as well. For this reason, you can not have the screen reader focus on an off-screen element.

Below is the final result of all these changes (you'll get a better feel for this by trying it with an assistive technology such as [NVDA](https://www.nvaccess.org/) or [VoiceOver](https://www.apple.com/accessibility/vision/)). Check out the [full source code here](/en-US/docs/Learn/Forms/How_to_build_custom_form_controls/Example_5).
Below is the final result of all these changes (you'll get a better feel for this by trying it with an assistive technology such as [NVDA](https://www.nvaccess.org/) or [VoiceOver](https://www.apple.com/accessibility/vision/)).

#### Live example

Check out the [full source code here](/en-US/docs/Learn/Forms/How_to_build_custom_form_controls/Example_5).

```html hidden
<form class="no-widget">
Expand Down Expand Up @@ -1954,7 +1962,7 @@ window.addEventListener("load", () => {
});
```

{{EmbedLiveSample("The_aria-selected_attribute",120,130)}}
{{EmbedLiveSample("live_example_3",120,130)}}

If you want to move forward, the code in this example needs some improvement before it becomes generic and reusable. This is an exercise you can try to perform. Two hints to help you in this: the first argument for all our functions is the same, which means those functions need the same context. Building an object to share that context would be wise.

Expand Down Expand Up @@ -2059,7 +2067,7 @@ If you do create alternative controls via radio buttons, your own JavaScript, or
- [Your first HTML form](/en-US/docs/Learn/Forms/Your_first_form)
- [How to structure an HTML form](/en-US/docs/Learn/Forms/How_to_structure_a_web_form)
- [The native form widgets](/en-US/docs/Learn/Forms/Basic_native_form_controls)
- [The native form controls](/en-US/docs/Learn/Forms/Basic_native_form_controls)
- [HTML5 input types](/en-US/docs/Learn/Forms/HTML5_input_types)
- [Additional form controls](/en-US/docs/Learn/Forms/Other_form_controls)
- [UI pseudo-classes](/en-US/docs/Learn/Forms/UI_pseudo-classes)
Expand All @@ -2070,7 +2078,7 @@ If you do create alternative controls via radio buttons, your own JavaScript, or
### Advanced Topics
- [Sending forms through JavaScript](/en-US/docs/Learn/Forms/Sending_forms_through_JavaScript)
- **How to build custom form widgets**
- **How to build custom form controls**
- [HTML forms in legacy browsers](/en-US/docs/Learn/Forms/HTML_forms_in_legacy_browsers)
- [Advanced styling for HTML forms](/en-US/docs/Learn/Forms/Advanced_form_styling)
- [Property compatibility table for form widgets](/en-US/docs/Learn/Forms/Property_compatibility_table_for_form_controls)
- [Property compatibility table for form controls](/en-US/docs/Learn/Forms/Property_compatibility_table_for_form_controls)
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ When browsers send requests to servers for HTML files, those HTML files often co

## DNS explained

Real web addresses aren't the nice, memorable strings you type into your address bar to find your favorite websites. They are special numbers that look like this: `63.245.215.20`.
Real web addresses aren't the nice, memorable strings you type into your address bar to find your favorite websites. They are special numbers that look like this: `192.0.2.172`.

This is called an {{Glossary("IP Address", "IP address")}}, and it represents a unique location on the web. However, it's not very easy to remember, is it? That's why the Domain Name System was invented. This system uses special servers that match up a web address you type into your browser (like "mozilla.org") to the website's real (IP) address.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The goal is to rewrite the following math article using HTML and MathML:

Although you don't need to be familiar with [LaTeX](https://en.wikipedia.org/wiki/LaTeX), it might be useful to know the LaTeX source from which it was generated:

```
```latex
\documentclass{article}
\usepackage{amsmath}
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/learn/performance/css/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ To optimize the CSSOM construction and improve page performance, you can do one

Making your selectors less complex and specific is also good for maintenance. It is easy to understand what simple selectors are doing, and it is easy to override styles when needed later on if the selectors are less [specific](/en-US/docs/Learn/CSS/Building_blocks/Cascade_and_inheritance#specificity_2).

- **Don't apply styles to more elements than needed**: A common mistake is to apply styles to all elements using the [universal selector](/en-US/docs/Web/CSS/Universal_selectors), or at least, to more elements than needed. This kind of styling can impact performance neagtively, especially on larger sites.
- **Don't apply styles to more elements than needed**: A common mistake is to apply styles to all elements using the [universal selector](/en-US/docs/Web/CSS/Universal_selectors), or at least, to more elements than needed. This kind of styling can impact performance negtively, especially on larger sites.

```css
/* Selects every element inside the <body> */
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/learn/performance/html/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ You can also lazy load video content by using the `preload` attribute. For examp
</video>
```

Giving `preload` a value of `none` tells the browser to not preload any of the video data before the user decides to play it, which is obviously good for preformance. Instead, it will just show the image indicated by the `poster` attribute. Different browsers have different default video loading behavior, so it is good to be explicit.
Giving `preload` a value of `none` tells the browser to not preload any of the video data before the user decides to play it, which is obviously good for performance. Instead, it will just show the image indicated by the `poster` attribute. Different browsers have different default video loading behavior, so it is good to be explicit.

See [Lazy loading video](https://web.dev/lazy-loading-video/) on web.dev for detailed information.

Expand Down Expand Up @@ -193,7 +193,7 @@ Ordering of resource loading is important for maximizing perceived and actual pe

1. The HTML is generally parsed first, in the order in which it appears on the page.
2. Any found CSS is parsed to understand the styles that need to be applied to the page. During this time, linked assets such as images and web fonts start to be fetched.
3. Any found JavaScript is parsed, evaluated, and run against the page. By default, this blocks parsing of the HTML that appears after the {{htmlelement("script")}} elements where the JavaScript is encoountered.
3. Any found JavaScript is parsed, evaluated, and run against the page. By default, this blocks parsing of the HTML that appears after the {{htmlelement("script")}} elements where the JavaScript is encountered.
4. Slightly later on, the browser works out how each HTML element should be styled, given the CSS applied to it.
5. The styled result is then painted to the screen.

Expand Down
Loading

0 comments on commit efac47f

Please sign in to comment.