Module 4-02

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/30

encourage image

There's no tags or description

Looks like no tags are added yet.

31 Terms

1
New cards

Document Object Model

It’s a programming interface that represents an HTML or XML document as hierarchical tree structure of nodes and objects, allowing languages like JavaScript to interact with, modify, and update the page’s content, structure, and styles dynamically.

2
New cards

DOM tree

It is a representation of a parsed HTML document where:

  • Nodes are represented elements, element attributes, textual content, and other HTML document components.

  • Accessed through the Document object property of the Window object.


3
New cards

Basic DOM interfaces

Document, Node, Element, Event, Text, Attr

4
New cards

JS APIs

Aside from the Core JS Language, JS uses additional WEB APIs to access objects in the browser’s runtime environment and the HTML document

5
New cards

Browser Object Model (BOM) API

It is non-standard, and includes the following: Window, Navigator, Screen, Location, and History


6
New cards

Construct/Copy nodes

It is a DOM API functionality:

  • createElement()

  • createTextNode()

  • createAttribute()


7
New cards

Node collections

It is a DOM API functionality:

  • getElementById()

  • getElementsByTagName()

  • querySelector()


8
New cards

Traverse the DOM tree

It is a DOM API functionality:
- parentNode, parentElement, childNodes, children, firstChild, lastChild, nextSibling, previousSibling, firstElementChild, lastElementChild, etc.

9
New cards

Manipulate the DOM tree

It is a DOM API functionality:

  • appendChild()

  • removeChild()

  • replaceChild()


10
New cards

Event Handling

It is a DOM API functionality:

  • addEventListener()

  • removeEventListener


11
New cards

Styles

It is a DOM API functionality:

  • styleSheets

  • cssRules

  • insertRule

  • getComputerStyle


12
New cards

HTML DOM API

This extends the DOM API for additional element-specific features.

  • HTMLElement interface:(extends Element) and HTML element interfaces such as HTMLDivElement,

  • HTMLParagraphElement, HTMLCanvasElement, MathMLElement) inherits from HTMLElement. Some properties of HTMLElement id, ClassName, innerHTML, hidden


13
New cards

SVG API

Events occur in the DOM as a result of user interaction or are generated by APIs to represent the status of tasks or DOM tree components (e.g., mouse click, loading of a page

14
New cards

currentTarget

listens for the event and may handle the event

15
New cards

Sampler Handler

knowt flashcard image
16
New cards

Event Registration

associates the event and the event handler

17
New cards

Inline (non-standard)

An event registration that uses the HTML <event> attribute. The attribute’s value (such as handler()above) is copied to the DOM, and thus can be accessed by JS

<p>An event registration that uses the HTML &lt;event&gt; attribute. The attribute’s value (such as handler()above) is copied to the DOM, and thus can be accessed by JS</p>
18
New cards

Assigned through JS

An event registration that uses the DOM on the <event> property of the JS

object.

  • The parentheses are omitted - the function itself is assigned to

  • the property, not the function’s return value

  • Only one handler can be registered to unassign (remove) the handler; assign null to the attribute


<p>An event registration that uses the DOM on the &lt;event&gt; property of the JS</p><p>object.</p><ul><li><p>The parentheses are omitted - the function itself is assigned to</p></li><li><p>the property, not the function’s return value</p></li><li><p>Only one handler can be registered to unassign (remove) the handler; assign null to the attribute</p></li></ul><p></p>
19
New cards
<p>addEventListener and removeEventListener (standard)</p>

addEventListener and removeEventListener (standard)

An event registration where the argument to the method is the event itself

Multiple handlers can be registered with the same event

<p>An event registration where the argument to the method is the event itself</p><p>Multiple handlers can be registered with the same event</p>
20
New cards

Browser

An execution environment where it can parse HTML, evaluate CSS, load images, download and execute JS, and render the page

21
New cards

Javascript

An execution environment where this may be top-level code: code outside functions and code inside functions

22
New cards

Top-level code

An execution environment where these are executed immediately, while functions need to be invoked first.

23
New cards

HTML Markup

This is fetched and parsed to build the document structure

(DOM tree) is created. A preload scanner fetches resources like CSS, JS, and fonts in the background while the main thread continues to build the DOM

24
New cards

These, if referenced, are fetched as well.

  • The CSSOM tree is created, and the cascade is used to determine property values. Recursive calculation occurs when the DOM or CSS properties change.

  • This does not block HTML but may block scripts (due to the effect of styles on elements / DOM objects).


25
New cards

Regular Scripts

These are downloaded as they are encountered and executed.

  • Parsing, compilation, and interpretation are done on the main thread. Top-level code is executed immediately while blocking HTML.

  • Background processes (e.g., code in web workers) will NOT block HTML.

  • Likewise, external scripts with the async and defer attributes will behave differently.


26
New cards

DOMContentLoaded

The event fires when the initial HTML document has been completely loaded and parsed by the browser

27
New cards

CSSOM Tree

When this is completed, the DOM tree and this are combined to build the render tree. Every visible element’s layout, content, and computed style are determined and included in the render tree; elements in <head> and those with display:none are omitted

28
New cards

Size and Positions

These on the page are determined.

  • The render tree is traversed from the <body>, and placeholders are set on the page for each object in the tree (layout & reflow).

  • These are eventually painted on screen


29
New cards

load event

In the topic of Web Document Parsing, this is triggered after the entire page is rendered.

30
New cards

external script with defer attribute

Although the execution of a script blocks other tasks in the environment, note that this is downloaded asynchronously with HTML and other web resources, and executes only after the web document has been parsed and the needed styles are available, but before firing DOMContentLoaded

31
New cards

external script with async attribute

Although the execution of a script blocks other tasks in the environment, note that this is downloaded asynchronously with HTML and other web resources, and executes as soon as it has been fetched in full, but before the Load event is fired