サクサク読めて、アプリ限定の機能も多数!
トップへ戻る
Switch 2
javascript.info
There’s a special syntax to work with promises in a more comfortable fashion, called “async/await”. It’s surprisingly easy to understand and use. Async functionsLet’s start with the async keyword. It can be placed before a function, like this: The word “async” before a function means one simple thing: a function always returns a promise. Other values are wrapped in a resolved promise automatically
Drag’n’Drop is a great interface solution. Taking something and dragging and dropping it is a clear and simple way to do many things, from copying and moving documents (as in file managers) to ordering (dropping items into a cart). In the modern HTML standard there’s a section about Drag and Drop with special events such as dragstart, dragend, and so on. These events allow us to support special ki
To move elements around we should be familiar with coordinates. Most JavaScript methods deal with one of two coordinate systems: Relative to the window – similar to position:fixed, calculated from the window top/left edge. we’ll denote these coordinates as clientX/clientY, the reasoning for such name will become clear later, when we study event properties. Relative to the document – similar to pos
Shadow DOM may include both <style> and <link rel="stylesheet" href="…"> tags. In the latter case, stylesheets are HTTP-cached, so they are not redownloaded for multiple components that use same template. As a general rule, local styles work only inside the shadow tree, and document styles work outside of it. But there are few exceptions. :hostThe :host selector allows to select the shadow host (t
In JavaScript, we rarely think about memory management. It appears natural that we create variables, use them and the browser takes care about low-level details. But as applications become complex and AJAXy, and a visitor stays on a page for a long time, we may notice problems like a browser takes 1G+ and grows larger and larger in size. That’s usually because of memory leaks. Here we discuss the
We may decide to execute a function not right now, but at a certain time later. That’s called “scheduling a call”. There are two methods for it: setTimeout allows us to run a function once after the interval of time. setInterval allows us to run a function repeatedly, starting after the interval of time, then repeating continuously at that interval. These methods are not a part of JavaScript speci
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. load – not only HTML is loaded, but also all the external resources: images, styles etc. beforeunload/unload – the user is leaving the page. Each event may be useful: DOMContentLoad
Let’s start with an example. This handler is assigned to <div>, but also runs if you click any nested tag like <em> or <code>: <div onclick="alert('The handler!')"> <em>If you click on <code>EM</code>, the handler on <code>DIV</code> runs.</em> </div>
We want to make this open-source project available for people all around the world. Help to translate the content of this tutorial to your language!
The “Same Origin” (same site) policy limits access of windows and frames to each other. The idea is that if a user has two pages open: one from john-smith.com, and another one is gmail.com, then they wouldn’t want a script from john-smith.com to read our mail from gmail.com. So, the purpose of the “Same Origin” policy is to protect users from information theft. Same OriginTwo URLs are said to have
このページを最初にブックマークしてみませんか?
『The Modern JavaScript Tutorial』の新着エントリーを見る
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く