minor fixes
This commit is contained in:
parent
823eea4dae
commit
2957e71a05
2 changed files with 3 additions and 3 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
The lifecycle of an HTML page has three important events:
|
The lifecycle of an HTML page has three important events:
|
||||||
|
|
||||||
- `DOMContentLoaded` -- the browser fully loaded HTML, and the DOM tree is built, but external resources like pictures `<img>` and stylesheets may not yet have loaded.
|
- `DOMContentLoaded` -- the browser fully loaded HTML, and the DOM tree is built, but external resources like pictures `<img>` and stylesheets may not yet have loaded.
|
||||||
- `load` -- not only HTML is loaded, but also all the external resources: images, styles etc.
|
- `load` -- not only HTML is loaded, but also all the external resources: images, styles etc.
|
||||||
- `beforeunload/unload` -- the user is leaving the page.
|
- `beforeunload/unload` -- the user is leaving the page.
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ The example below correctly shows image sizes, because `window.onload` waits for
|
||||||
|
|
||||||
```html run height=200 refresh
|
```html run height=200 refresh
|
||||||
<script>
|
<script>
|
||||||
window.onload = function() { // same as window.addEventListener('load', (event) => {
|
window.onload = function() {
|
||||||
alert('Page loaded');
|
alert('Page loaded');
|
||||||
|
|
||||||
// image is loaded at this time
|
// image is loaded at this time
|
||||||
|
|
|
@ -202,7 +202,7 @@ If both windows are listening for `window.onstorage`, then each one will react o
|
||||||
|
|
||||||
```js run
|
```js run
|
||||||
// triggers on updates made to the same storage from other documents
|
// triggers on updates made to the same storage from other documents
|
||||||
window.onstorage = event => { // same as window.addEventListener('storage', event => {
|
window.onstorage = event => {
|
||||||
if (event.key != 'now') return;
|
if (event.key != 'now') return;
|
||||||
alert(event.key + ':' + event.newValue + " at " + event.url);
|
alert(event.key + ':' + event.newValue + " at " + event.url);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue