Skip to content
Merged
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
12 changes: 7 additions & 5 deletions files/en-us/_redirects.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,7 @@
/en-US/docs/DOM/Input.setSelectionRange /en-US/docs/Web/API/HTMLInputElement/setSelectionRange
/en-US/docs/DOM/KeyboardEvent /en-US/docs/Web/API/KeyboardEvent
/en-US/docs/DOM/LinkStyle /en-US/docs/Web/API/HTMLLinkElement
/en-US/docs/DOM/Locating_DOM_elements_using_selectors /en-US/docs/Web/API/Document_Object_Model/Locating_DOM_elements_using_selectors
/en-US/docs/DOM/Locating_DOM_elements_using_selectors /en-US/docs/Web/API/Document_Object_Model/Selection_and_traversal_on_the_DOM_tree
/en-US/docs/DOM/Manipulating_the_browser_history /en-US/docs/Web/API/History_API
/en-US/docs/DOM/Manipulating_the_browser_history/Example /en-US/docs/Web/API/History_API/Working_with_the_History_API
/en-US/docs/DOM/MediaQueryList /en-US/docs/Web/API/MediaQueryList
Expand Down Expand Up @@ -2824,7 +2824,7 @@
/en-US/docs/Document_Object_Model_(DOM)/Input.select /en-US/docs/Web/API/HTMLInputElement/select
/en-US/docs/Document_Object_Model_(DOM)/Input.setSelectionRange /en-US/docs/Web/API/HTMLInputElement/setSelectionRange
/en-US/docs/Document_Object_Model_(DOM)/KeyboardEvent /en-US/docs/Web/API/KeyboardEvent
/en-US/docs/Document_Object_Model_(DOM)/Locating_DOM_elements_using_selectors /en-US/docs/Web/API/Document_Object_Model/Locating_DOM_elements_using_selectors
/en-US/docs/Document_Object_Model_(DOM)/Locating_DOM_elements_using_selectors /en-US/docs/Web/API/Document_Object_Model/Selection_and_traversal_on_the_DOM_tree
/en-US/docs/Document_Object_Model_(DOM)/MediaQueryList /en-US/docs/Web/API/MediaQueryList
/en-US/docs/Document_Object_Model_(DOM)/MediaQueryListListener /en-US/docs/Web/API/MediaQueryList
/en-US/docs/Document_Object_Model_(DOM)/NamedNodeMap /en-US/docs/Web/API/NamedNodeMap
Expand Down Expand Up @@ -7775,7 +7775,7 @@
/en-US/docs/Transforming_XML_with_XSLT:The_Netscape_XSLT_XPath_Reference:Elements:xsl:decimal-format /en-US/docs/Web/XML/XSLT/Reference/Element/decimal-format
/en-US/docs/Transforming_XML_with_XSLT:The_Netscape_XSLT_XPath_Reference:Elements:xsl:element /en-US/docs/Web/XML/XSLT/Reference/Element/element
/en-US/docs/Transforming_XML_with_XSLT:The_Netscape_XSLT_XPath_Reference:Functions /en-US/docs/Web/XML/XPath/Reference/Functions
/en-US/docs/Traversing_an_HTML_table_with_JavaScript_and_DOM_Interfaces /en-US/docs/Web/API/Document_Object_Model/Traversing_an_HTML_table_with_JavaScript_and_DOM_Interfaces
/en-US/docs/Traversing_an_HTML_table_with_JavaScript_and_DOM_Interfaces /en-US/docs/Web/API/Document_Object_Model/Building_and_updating_the_DOM_tree
/en-US/docs/URI /en-US/docs/Glossary/URI
/en-US/docs/URI/www and non-www URLs /en-US/docs/Web/URI/Guides/Choosing_between_www_and_non-www_URLs
/en-US/docs/URI/www_vs_non-www_URLs /en-US/docs/Web/URI/Guides/Choosing_between_www_and_non-www_URLs
Expand Down Expand Up @@ -8533,8 +8533,10 @@
/en-US/docs/Web/API/Document_Object_Model/Examples /en-US/docs/Web/API/Document_Object_Model
/en-US/docs/Web/API/Document_Object_Model/How_to_create_a_DOM_tree /en-US/docs/Web/API/Document_Object_Model
/en-US/docs/Web/API/Document_Object_Model/Introduction /en-US/docs/Web/API/Document_Object_Model
/en-US/docs/Web/API/Document_Object_Model/Locating_DOM_elements_using_selectors /en-US/docs/Web/API/Document_Object_Model/Selection_and_traversal_on_the_DOM_tree
/en-US/docs/Web/API/Document_Object_Model/Preface /en-US/docs/Web/API/Document_Object_Model
/en-US/docs/Web/API/Document_Object_Model/Transforming_with_XSLT /en-US/docs/Web/XML/XSLT/Guides/Transforming_XML_with_XSLT
/en-US/docs/Web/API/Document_Object_Model/Traversing_an_HTML_table_with_JavaScript_and_DOM_Interfaces /en-US/docs/Web/API/Document_Object_Model/Building_and_updating_the_DOM_tree
/en-US/docs/Web/API/Document_Object_Model/Using_the_Document_Object_Model /en-US/docs/Web/API/Document_Object_Model
/en-US/docs/Web/API/Document_Object_Model/Using_the_Document_Object_Model/Example /en-US/docs/Web/API/Document_Object_Model
/en-US/docs/Web/API/Document_Object_Model/Using_the_W3C_DOM_Level_1_Core /en-US/docs/Web/API/Document_Object_Model
Expand Down Expand Up @@ -12843,7 +12845,7 @@
/en-US/docs/Web/Guide/API/DOM/Events/Touch_events /en-US/docs/Web/API/Touch_events
/en-US/docs/Web/Guide/API/DOM/Events/Touch_events_(Mozilla_experimental) /en-US/docs/Web/API/Touch_events
/en-US/docs/Web/Guide/API/DOM/Events/Using_device_orientation_with_3D_transforms /en-US/docs/Web/API/Device_orientation_events/Using_device_orientation_with_3D_transforms
/en-US/docs/Web/Guide/API/DOM/Locating_DOM_elements_using_selectors /en-US/docs/Web/API/Document_Object_Model/Locating_DOM_elements_using_selectors
/en-US/docs/Web/Guide/API/DOM/Locating_DOM_elements_using_selectors /en-US/docs/Web/API/Document_Object_Model/Selection_and_traversal_on_the_DOM_tree
/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history /en-US/docs/Web/API/History_API
/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history/Example /en-US/docs/Web/API/History_API/Working_with_the_History_API
/en-US/docs/Web/Guide/API/DOM/Storage /en-US/docs/Web/API/Web_Storage_API
Expand Down Expand Up @@ -12924,7 +12926,7 @@
/en-US/docs/Web/Guide/DOM/Events/Touch_events /en-US/docs/Web/API/Touch_events
/en-US/docs/Web/Guide/DOM/Events/Touch_events_(Mozilla_experimental) /en-US/docs/Web/API/Touch_events
/en-US/docs/Web/Guide/DOM/Events/Using_device_orientation_with_3D_transforms /en-US/docs/Web/API/Device_orientation_events/Using_device_orientation_with_3D_transforms
/en-US/docs/Web/Guide/DOM/Locating_DOM_elements_using_selectors /en-US/docs/Web/API/Document_Object_Model/Locating_DOM_elements_using_selectors
/en-US/docs/Web/Guide/DOM/Locating_DOM_elements_using_selectors /en-US/docs/Web/API/Document_Object_Model/Selection_and_traversal_on_the_DOM_tree
/en-US/docs/Web/Guide/DOM/Manipulating_the_browser_history /en-US/docs/Web/API/History_API
/en-US/docs/Web/Guide/DOM/Manipulating_the_browser_history/Example /en-US/docs/Web/API/History_API/Working_with_the_History_API
/en-US/docs/Web/Guide/DOM/Storage /en-US/docs/Web/API/Web_Storage_API
Expand Down
84 changes: 42 additions & 42 deletions files/en-us/_wikihistory.json
Original file line number Diff line number Diff line change
Expand Up @@ -29464,6 +29464,47 @@
"Dria"
]
},
"Web/API/Document_Object_Model/Building_and_updating_the_DOM_tree": {
"modified": "2020-08-22T02:28:27.619Z",
"contributors": [
"mfuji09",
"irenesmith",
"Zearin_Galaurum",
"ExE-Boss",
"dijonkitchen",
"epan5",
"jwhitlock",
"vinay97",
"teoli",
"marcio",
"rogerhc",
"kscarfone",
"Ichimonji10",
"jvns",
"trevorh",
"Sheppy",
"ethertank",
"TelaSocial",
"Nickolay",
"Jmtroncos",
"Huttarl",
"Koder",
"Mgjbot",
"Carrie zhxj",
"Waldo",
"Ranga.tech",
"Planche",
"Sebuls",
"Dria",
"Sandesh",
"NickolayBot",
"Burnt1ce85",
"Pslim",
"Jakul",
"Rvveelen",
"Ruby"
]
},
"Web/API/Document_Object_Model/Events": {
"modified": "2020-08-02T16:56:22.810Z",
"contributors": [
Expand Down Expand Up @@ -29525,7 +29566,7 @@
"Pomax"
]
},
"Web/API/Document_Object_Model/Locating_DOM_elements_using_selectors": {
"Web/API/Document_Object_Model/Selection_and_traversal_on_the_DOM_tree": {
"modified": "2020-12-06T22:57:45.352Z",
"contributors": [
"jordan-git",
Expand All @@ -29543,47 +29584,6 @@
"asadotzler"
]
},
"Web/API/Document_Object_Model/Traversing_an_HTML_table_with_JavaScript_and_DOM_Interfaces": {
"modified": "2020-08-22T02:28:27.619Z",
"contributors": [
"mfuji09",
"irenesmith",
"Zearin_Galaurum",
"ExE-Boss",
"dijonkitchen",
"epan5",
"jwhitlock",
"vinay97",
"teoli",
"marcio",
"rogerhc",
"kscarfone",
"Ichimonji10",
"jvns",
"trevorh",
"Sheppy",
"ethertank",
"TelaSocial",
"Nickolay",
"Jmtroncos",
"Huttarl",
"Koder",
"Mgjbot",
"Carrie zhxj",
"Waldo",
"Ranga.tech",
"Planche",
"Sebuls",
"Dria",
"Sandesh",
"NickolayBot",
"Burnt1ce85",
"Pslim",
"Jakul",
"Rvveelen",
"Ruby"
]
},
"Web/API/DragEvent": {
"modified": "2020-10-15T21:29:10.598Z",
"contributors": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ This should log "baked beans" (the name of the first product listed in "products

But wait! Remember the last article, where we said that by calling a callback inside another callback, we got successively more nested levels of code? And we said that this "callback hell" made our code hard to understand? Isn't this just the same, only with `then()` calls?

It is, of course. But the elegant feature of promises is that _`then()` itself returns a promise, which will be completed with the result of the function passed to it_. This means that we can (and certainly should) rewrite the above code like this:
It is, of course. But the elegant feature of promises is that `then()` itself returns a new promise that is fulfilled with the return value of the callback function (provided the function runs successfully). This means that we can (and certainly should) rewrite the above code like this:

```js
const fetchPromise = fetch(
Expand Down Expand Up @@ -184,15 +184,16 @@ Promises come with some quite specific terminology that it's worth getting clear

First, a promise can be in one of three states:

- **pending**: the promise has been created, and the asynchronous function it's associated with has not succeeded or failed yet. This is the state your promise is in when it's returned from a call to `fetch()`, and the request is still being made.
- **fulfilled**: the asynchronous function has succeeded. When a promise is fulfilled, its `then()` handler is called.
- **rejected**: the asynchronous function has failed. When a promise is rejected, its `catch()` handler is called.
- **pending**: The initial state. The operation has not yet completed (succeeded or failed).
- **fulfilled**: The operation succeeded. This is when the promise's `.then()` handler is called.
- **rejected**: The operation failed. This is when the promise's `.catch()` handler is called.

Note that what "succeeded" or "failed" means here is up to the API in question. For example, `fetch()` rejects the returned promise if (among other reasons) a network error prevented the request being sent, but fulfills the promise if the server sent a response, even if the response was an error like [404 Not Found](/en-US/docs/Web/HTTP/Reference/Status/404).

Sometimes, we use the term **settled** to cover both **fulfilled** and **rejected**.
We also use a few other terms to describe a promise's state:

A promise is **resolved** if it is settled, or if it has been "locked in" to follow the state of another promise.
- **completed**: The promise is no longer pending; it has either been fulfilled or rejected.
- **resolved**: The promise is completed, or it has been "locked in" to follow the state of another promise. This is a more advanced concept, relevant when one promise depends on another.

The article [Let's talk about how to talk about promises](https://thenewtoys.dev/blog/2021/02/08/lets-talk-about-how-to-talk-about-promises/) gives a great explanation of the details of this terminology.

Expand Down
2 changes: 1 addition & 1 deletion files/en-us/mozilla/firefox/releases/3.5/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ sidebar: firefox
- : Firefox 3.5 supports web workers to allow easy multi-threading support in web applications.
- [Using geolocation](/en-US/docs/Web/API/Geolocation_API)
- : Firefox 3.5 supports the Geolocation API, which allows web applications to obtain information about the user's current location if a provider for that information is installed and enabled.
- [Locating DOM elements using selectors](/en-US/docs/Web/API/Document_Object_Model/Locating_DOM_elements_using_selectors)
- [Locating DOM elements using selectors](/en-US/docs/Web/API/Document_Object_Model/Selection_and_traversal_on_the_DOM_tree)
- : The selectors API allows querying a document to locate the elements that match a given selection rule.
- [Mouse gesture events](https://web.archive.org/web/20210724051233/https://developer.mozilla.org/en-US/docs/Web/Events/Mouse_gesture_events)
- : Firefox 3.5 supports mouse gesture events such as trackpad swipes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,9 @@ The contrast ratio is defined in [WCAG 2.2](https://w3c.github.io/wcag/guideline

It's best if you can adjust the contrast before it is uploaded or published to the web. For videos and animated GIFs, the Adobe Suite of products is a phenomenal resource for traditional images. Also for images, an online tool available is pinetools.com's [Brightness and contrast online](https://pinetools.com/brightness-contrast-image). If you intend to make animated GIFs, for example, start with one that has a lower contrast ratio.

JavaScript is also an option for reducing contrast dynamically. Here's a code example from the section titled, ["Example: Setting the background color of a paragraph"](/en-US/docs/Web/API/Document_Object_Model/Traversing_an_HTML_table_with_JavaScript_and_DOM_Interfaces#setting_the_background_color_of_a_paragraph) from the MDN document, [Traversing an HTML table with JavaScript and DOM Interfaces](/en-US/docs/Web/API/Document_Object_Model/Traversing_an_HTML_table_with_JavaScript_and_DOM_Interfaces). Notice that the color in the example is described in the **RGB** color space.
JavaScript is also an option for reducing contrast dynamically. Here's a code example from the section titled, ["Example: Setting the background color of a paragraph"](/en-US/docs/Web/API/Document_Object_Model/Building_and_updating_the_DOM_tree#setting_the_background_color_of_a_paragraph). Notice that the color in the example is described in the **RGB** color space.

**HTML Content [(link to source page)](/en-US/docs/Web/API/Document_Object_Model/Traversing_an_HTML_table_with_JavaScript_and_DOM_Interfaces#html_2)**
**HTML Content [(link to source page)](/en-US/docs/Web/API/Document_Object_Model/Building_and_updating_the_DOM_tree#html_2)**

```html
<body>
Expand All @@ -375,7 +375,7 @@ JavaScript is also an option for reducing contrast dynamically. Here's a code ex
</body>
```

**JavaScript Content [(link to source page)](/en-US/docs/Web/API/Document_Object_Model/Traversing_an_HTML_table_with_JavaScript_and_DOM_Interfaces#javascript_2)**
**JavaScript Content [(link to source page)](/en-US/docs/Web/API/Document_Object_Model/Building_and_updating_the_DOM_tree#javascript_2)**

```js
function setBackground() {
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/document/queryselector/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ Clicking the first button gives an error, while the second and third buttons wor

## See also

- [Locating DOM elements using selectors](/en-US/docs/Web/API/Document_Object_Model/Locating_DOM_elements_using_selectors)
- [Selection and traversal on the DOM tree](/en-US/docs/Web/API/Document_Object_Model/Selection_and_traversal_on_the_DOM_tree)
- {{domxref("Element.querySelector()")}}
- {{domxref("Document.querySelectorAll()")}}
- {{domxref("Element.querySelectorAll()")}}
2 changes: 1 addition & 1 deletion files/en-us/web/api/document/queryselectorall/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ Clicking the first button gives an error, while the second and third buttons wor

## See also

- [Locating DOM elements using selectors](/en-US/docs/Web/API/Document_Object_Model/Locating_DOM_elements_using_selectors)
- [Selection and traversal on the DOM tree](/en-US/docs/Web/API/Document_Object_Model/Selection_and_traversal_on_the_DOM_tree)
- [Attribute selectors](/en-US/docs/Web/CSS/Attribute_selectors) in the CSS
Guide
- [Attribute selectors](/en-US/docs/Learn_web_development/Core/Styling_basics/Attribute_selectors) in the MDN Learning Area
Expand Down
Loading