-
JavaScript Event Loop: microtasks and macrotasks
The execution flow of browser JavaScript relies on an event loop. It is essential for optimization and the correct architecture. In this cover, you will first find the theory and then the practical applications. Event Loop Event loop has a straightforward concept. There exists an endless loop when the engine of JavaScript waits for tasks, runs them and then…
-
JavaScript Selection and Range
In this chapter, we are going to explore selection in the document and in form fields such as <input>. JavaScript is capable of getting the existing selection, selecting or deselecting partially or totally, and so on. Range Range is the basic concept of selection. It encompasses a pair of boundary points such as range start and…
-
JavaScript Mutation Observer
A built-in object that observes a DOM element, firing a callback in case of modifications is known as MutationObserver. Let’s start at the syntax and then cover use cases to show where it can be especially handy. The Mutation Observer Syntax MutationObserveris simple in usage. The first step should be creating an observer using a callback-function, like this: The next…