Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Jean-Yves Perrier <[email protected]>
  • Loading branch information
wbamberg and teoli2003 authored Nov 7, 2023
1 parent b7f45fa commit 72c6ca1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion files/en-us/mozilla/firefox/releases/5/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Firefox 5, based on Gecko 5.0, was released on June 21, 2011. This article provi
- The {{ domxref("selection") }} object's [`modify()`](/en-US/docs/Web/API/Selection/modify) method has been changed so that the "word" selection granularity no longer includes trailing spaces; this makes it more consistent across platforms and matches the behavior of WebKit's implementation.
- The {{ domxref("setTimeout()") }} method now clamps to send no more than one timeout per second in inactive tabs. In addition, it now clamps nested timeouts to the smallest value allowed by the HTML5 specification: 4 ms (instead of the 10 ms it used to clamp to).
- Similarly, the {{ domxref("setInterval()") }} method now clamps to no more than one interval per second in inactive tabs.
- [`XMLHttpRequest`](/en-US/docs/Web/API/XMLHttpRequest) now [supports the `loadend` event](/en-US/docs/Web/API/_XMLHttpRequest_API/_Using_XMLHttpRequest#detecting_any_load_end_condition) for progress listeners. This is sent after any transfer is finished (that is, after the `abort`, `error`, or `load` event). You can use this to handle any tasks that need to be performed regardless of success or failure of a transfer.
- [`XMLHttpRequest`](/en-US/docs/Web/API/XMLHttpRequest) now [supports the `loadend` event](/en-US/docs/Web/API/_XMLHttpRequest_API/Using_XMLHttpRequest#detecting_any_load_end_condition) for progress listeners. This is sent after any transfer is finished (that is, after the `abort`, `error`, or `load` event). You can use this to handle any tasks that need to be performed regardless of success or failure of a transfer.
- The {{ domxref("Blob") }} and, by extension, the {{ domxref("File") }} objects' `slice()` method has been removed and replaced with a new, proposed syntax that makes it more consistent with [`Array.slice()`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice) and [`String.slice()`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice) methods in JavaScript. This method is named `mozSlice()` for now.
- The value of {{ domxref("window.navigator.language") }} is now determined by looking at the value of the `Accept-Language` [HTTP header](/en-US/docs/Web/HTTP/Headers).
- The {{ domxref("Element.prefix") }} property is now read only, as required by the DOM specification.
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/xmlhttprequest/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ _This interface also inherits properties of {{domxref("XMLHttpRequestEventTarget

- [Ajax](/en-US/docs/Web/Guide/AJAX)

- [Using XMLHttpRequest](/en-US/docs/Web/API/XMLHttpRequest_API/Using_XMLHttpRequest)
- [Using XMLHttpRequest](/en-US/docs/Web/API/XMLHttpRequest_API/Using_XMLHttpRequest):

- [HTML in XMLHttpRequest](/en-US/docs/Web/API/XMLHttpRequest_API/HTML_in_XMLHttpRequest)
- [Fetch API](/en-US/docs/Web/API/Fetch_API)
Expand Down
8 changes: 4 additions & 4 deletions files/en-us/web/api/xmlhttprequest_api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ spec-urls: https://xhr.spec.whatwg.org/

{{AvailableInWorkers("notservice")}}

The XMLHttpRequest API enables web apps to make HTTP requests to web servers and receive the responses programmatically using JavaScript. This in turn enables a website to update just part of a page with data from the server, rather than having to navigate to a whole new page. This practice is also sometimes known as {{glossary("Ajax")}}.
The **XMLHttpRequest API** enables web apps to make HTTP requests to web servers and receive the responses programmatically using JavaScript. This in turn enables a website to update just part of a page with data from the server, rather than having to navigate to a whole new page. This practice is also sometimes known as {{glossary("Ajax")}}.

The [Fetch API](/en-US/docs/Web/API/Fetch_API) is the more flexible and powerful replacement for XMLHttpRequest. The Fetch API uses {{jsxref("Promise", "promises", "", "nocode")}} instead of events to handle asynchronous responses, integrates well with [service workers](/en-US/docs/Web/API/Service_Worker_API), and supports advanced aspects of HTTP such as [CORS](/en-US/docs/Web/HTTP/CORS). For these reasons and more, the Fetch API is usually used in modern web apps instead of XMLHttpRequest.
The [Fetch API](/en-US/docs/Web/API/Fetch_API) is the more flexible and powerful replacement for the XMLHttpRequest API. The Fetch API uses {{jsxref("Promise", "promises", "", "nocode")}} instead of events to handle asynchronous responses, integrates well with [service workers](/en-US/docs/Web/API/Service_Worker_API), and supports advanced aspects of HTTP such as [CORS](/en-US/docs/Web/HTTP/CORS). For these reasons, the Fetch API is usually used in modern web apps instead of {{domxref("XMLHttpRequest")}}.

## Concepts and usage

The central interface in the XMLHttpRequest API is {{domxref("XMLHttpRequest")}}. To make an HTTP request:

1. Create a new `XMLHttpRequest` instance by calling its {{domxref("XMLHttpRequest.XMLHttpRequest", "constructor", "", "nocode")}}.
2. Initialize it by calling {{domxref("XMLHttpRequest.open()")}}. At this point you provide the URL for the request, the [HTTP method](/en-US/docs/Web/HTTP/Methods) to use, and optionally, a username and password.
2. Initialize it by calling {{domxref("XMLHttpRequest.open()")}}. At this point you provide the URL for the request, the [HTTP method](/en-US/docs/Web/HTTP/Methods) to use, and optionally, a username and a password.
3. Attach event handlers to get the result of the request. For example, the {{domxref("XMLHttpRequest.load_event", "load")}} event fires when the request has successfully completed, and the {{domxref("XMLHttpRequest.error_event", "error")}} event fires in various error conditions.
4. Send the request by calling {{domxref("XMLHttpRequest.send()")}}.

For an in-depth guide to XMLHttpRequest, see [Using XMLHttpRequest](/en-US/docs/Web/API/XMLHttpRequest_API/Using_XMLHttpRequest).
For an in-depth guide to the XMLHttpRequest API, see [Using XMLHttpRequest](/en-US/docs/Web/API/XMLHttpRequest_API/Using_XMLHttpRequest).

## Interfaces

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ This is building a 512-byte array of 8-bit integers and sending it; you can use

## Submitting forms and uploading files

See [FormData](/en-US/docs/Web/API/FormData).
See [`FormData`](/en-US/docs/Web/API/FormData).

0 comments on commit 72c6ca1

Please sign in to comment.