HTML DOM trees

0
The Document Object Model (DOM) is a fundamental concept in web development that defines the structure and organization of a web page's elements and attributes. In the context of the HTML Standard established by the WHATWG (Web Hypertext Application Technology Working Group), it's crucial to understand the common infrastructure and terminology that governs how elements and attributes are processed and manipulated within the DOM.

Ignoring and Treating Elements and Attributes:

When it is stated that some element or attribute is ignored, treated as another value, or handled as if it were something else, it refers to the processing of the node after it is incorporated into the DOM. Importantly, a user agent must not mutate the DOM in such situations. This means that while elements or attributes may be transformed for rendering or other purposes, the underlying DOM structure remains unchanged.

Content Attribute Changes:

A content attribute is said to change value only if its new value is different than its previous value. This means that setting an attribute to a value it already possesses does not trigger a change in the attribute. This concept is essential for efficient updates and modifications of the DOM.

Understanding "Empty":

The term "empty" in the context of an attribute value, Text node, or string, means that the length of the text is zero. It signifies that the content does not contain any characters, including control characters or U+0020 SPACE.

Element-Specific Insertion and Removal Steps:

In the HTML Standard, an HTML element can have specific HTML element insertion steps and removal steps defined for its local name. These steps provide a blueprint for how an element should be processed when inserted into or removed from the DOM.

Insertion Steps:

The insertion steps for the HTML Standard, given an inserted node, are defined as follows:
  •  If insertedNode is an element within the HTML namespace and has HTML element insertion steps defined for its local name, run the corresponding steps for that element.
  • If insertedNode is a form-associated element or an ancestor of such an element, certain actions are taken, including resetting the form owner.

Removal Steps:

Similarly, the removal steps for the HTML Standard, given a removed node and its old parent, are defined as follows:
  • Various actions are taken, such as updating focus and resetting form ownership.
  • If the removedNode is an element within the HTML namespace with HTML element removal steps defined, the corresponding steps are executed.

Insertion and Removal Effects:

Nodes are considered inserted into a document when the insertion steps are invoked with the node as an argument, and it is part of the document tree. Conversely, a node is removed from a document when the removal steps are invoked with it as the argument, and it is no longer part of the document tree.

Node Connectivity:

Nodes become connected when the insertion steps are invoked with them as arguments, and they are now considered connected to the document. Conversely, nodes become disconnected when the removal steps are invoked with them as arguments, and they are no longer connected.

Browsing-Context Connectivity:

Nodes are considered browsing-context connected when they are connected and their shadow-including root's browsing context is non-null. Nodes become browsing-context disconnected when the removal steps are invoked with them as arguments, or when their shadow-including root's browsing context becomes null.
Tags

Post a Comment

0Comments
Post a Comment (0)