From b2af245691420eb2d78227337628aa5f1be8ae4f Mon Sep 17 00:00:00 2001 From: Osvaldo Dias dos Santos Date: Sun, 5 Mar 2023 22:25:44 +0100 Subject: [PATCH] Update "Page: DOMContentLoaded..." files --- .../01-onload-ondomcontentloaded/article.md | 12 ++++++------ .../readystate.view/index.html | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/2-ui/5-loading/01-onload-ondomcontentloaded/article.md b/2-ui/5-loading/01-onload-ondomcontentloaded/article.md index c127bd6c0..07624a658 100644 --- a/2-ui/5-loading/01-onload-ondomcontentloaded/article.md +++ b/2-ui/5-loading/01-onload-ondomcontentloaded/article.md @@ -9,7 +9,7 @@ The lifecycle of an HTML page has three important events: Each event may be useful: - `DOMContentLoaded` event -- DOM is ready, so the handler can lookup DOM nodes, initialize the interface. -- `load` event -- additional resources are loaded, we can get image sizes (if not specified in HTML/CSS) etc. +- `load` event -- external resources are loaded, so styles are applied, image sizes are known etc. - `beforeunload` event -- the user is leaving: we can check if the user saved the changes and ask them whether they really want to leave. - `unload` -- the user almost left, but we still can initiate some operations, such as sending out statistics. @@ -60,7 +60,7 @@ So DOMContentLoaded definitely happens after such scripts: ```html run @@ -88,7 +88,7 @@ But there's a pitfall. If we have a script after the style, then that script mus ```html run ``` @@ -149,12 +149,12 @@ window.addEventListener("unload", function() { ``` - The request is sent as POST. -- We can send not only a string, but also forms and other formats, as described in the chapter , but usually it's a stringified object. +- We can send not only a string, but also forms and other formats, as described in the chapter , but usually it's a stringified object. - The data is limited by 64kb. When the `sendBeacon` request is finished, the browser probably has already left the document, so there's no way to get server response (which is usually empty for analytics). -There's also a `keepalive` flag for doing such "after-page-left" requests in [fetch](info:fetch-basics) method for generic network requests. You can find more information in the chapter . +There's also a `keepalive` flag for doing such "after-page-left" requests in [fetch](info:fetch) method for generic network requests. You can find more information in the chapter . If we want to cancel the transition to another page, we can't do it here. But we can use another event -- `onbeforeunload`. @@ -265,7 +265,7 @@ Here's a document with ` - + diff --git a/2-ui/5-loading/01-onload-ondomcontentloaded/readystate.view/index.html b/2-ui/5-loading/01-onload-ondomcontentloaded/readystate.view/index.html index a4685a716..27df70939 100644 --- a/2-ui/5-loading/01-onload-ondomcontentloaded/readystate.view/index.html +++ b/2-ui/5-loading/01-onload-ondomcontentloaded/readystate.view/index.html @@ -9,8 +9,8 @@ [20] readyState:interactive [21] DOMContentLoaded [30] iframe onload - [40] readyState:complete [40] img onload + [40] readyState:complete [40] window onload -->