Mindblown: a blog about philosophy.
-
JavaScript Coordinates
For moving elements around, it is necessary to learn about coordinates. The majority of JavaScript methods operate with one of the following two coordinate systems: Relative to the window and relative to the document. The first system is like position:fixed and is calculated from the window top/left edge. Its coordinates will be denoted as clientX/clientY. The second one…
-
JavaScript Window Sizes and Scrolling
For finding the width and height of the browser window, for scrolling the page using JavaScript, and more actions, the root document element document.documentElement is used. It corresponds to the <html> tag. But, there are other essential methods and peculiarities we are going to cover in this chapter. Width/height of the Window For getting the window height and width,…
-
Styles and Classes
In this chapter, we are going to show you how to alter the DOM by modifying styles and classes. But, before getting into the JavaScript ways of modifying styles and classes let’s check out an important rule. In general, there exist two ways of styling an element: Creating a class in CSS, as well as adding it <div class=”…”>. Writing properties…
-
JavaScript Modifying the document
The key to creating so-called “live” pages is DOM modification. In this chapter, we are going to show you how to create new elements on the fly, as well as modify the existing page content. When writing apps or web pages, the first thing you will want to do is manipulating the document structure. Normally,…
-
Attributes and Properties
In HTML, you can write, declare elements, and pass values in attributes. In JavaScript, particularly in DOM, there are properties available while querying HTML elements via the DOM. In this chapter, the attributes, and properties of JavaScript are covered. DOM Properties JavaScript DOM objects have properties. They are like instance variables for the particular element.…
-
Node Properties:Type, Tag and Contents
In this chapter, we are going to take an in-depth look at the DOM nodes in JavaScript. Let’s explore what they are and learn their most common properties. DOM Node Classes Different DOM nodes obtain various properties. For example, an element node that corresponds to tag <a> has link-related properties. The one that corresponds to <input> has input-related properties. Text nodes and…
-
JavaScript Searching:getElement*, querySelector*
As you already know, JavaScript DOM is a tree-like structure, made of all the elements existing in your HTML document. What is essential is that the HTML elements are floating around in a way that you want to access and read data from or change it. There exist many ways of finding those elements. In this chapter, you will find out…
-
JavaScript Browser Environment, Specs
Initially, JavaScript was created for web browsers. But, since then, it has expanded and become a language with different platforms and uses. A platform can be a browser, a web-server, or another host. Each of them includes a platform-specific functionality. For JavaScript specification, it is a host environment. A host environment has its own objects and functions…
-
JavaScript File and FileReader
Let’s explore File and FileReader in JavaScript. As a rule, a file object inherits from the Blob. It can be extended to filesystem-related facilities. You can obtain it in two ways: The first way is using a constructor similar to Blob:new File(fileParts, fileName, [options]) As a rule, a file can be received from <input type=”file”>, or drag and drop or other…
-
JavaScript Blob
The browser has additional high-level objects. Among them is the Blob. The Blob object visualizes a blob that is a file-like object of immutable. The Blob is a raw data: you can read it both as binary data or text. It consists of an optional string type, blobParts, strings, as well as BufferSource. Constructing a Blob For constructing a Blob from other data and non-blob objects, the Blob() constructor…
Got any book recommendations?