DOM (extra) Flashcards

1
Q

What is the Document Object Model (DOM)?

A

The DOM is a programming interface for HTML and XML documents. It represents a document as a tree of objects, allowing developers to create, read, update, and delete elements and content on a webpage.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is XML?

A

XML, or Extensible Markup Language, is a markup language designed for storing and transporting data. Unlike HTML, which focuses on the display of data, XML’s primary purpose is to structure, store, and transport information in a way that is both human-readable and machine-readable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Why is the DOM important in web development?

A

The DOM allows developers to:

  • Change the content of a web page without reloading it.
  • Create interactive and dynamic web applications.
  • Manage the structure and style of documents separately.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the basic building blocks of the DOM?

A

The DOM consists of nodes and elements:

  • Node: A single point in the DOM tree (like an HTML element, text, attribute, etc.).
  • Element Node: Represents a specific HTML element, like < div>, < p>, or < img>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How is the DOM structured?

A

The DOM is structured as a tree, where:

  • The root node is the < html> element.
  • Each node can have child nodes (elements or text).
  • Nodes are connected as parents, children, and siblings.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the main types of nodes in the DOM?

A

The main types of nodes are:

  • Element Node: Represents HTML elements.
  • Text Node: Contains the text inside an element.
  • Attribute Node: Represents an attribute of an element (like class or id).
  • Comment Node: Contains comments within the HTML or XML.
  • Document Node: The root of the document, representing the entire HTML or XML document.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are some common methods to access nodes in the DOM?

A
  • getElementById(id): Returns the element with the specified ID.
  • getElementsByTagName(tagName): Returns all elements with the specified tag name.
  • getElementsByClassName(className): Returns all elements with the specified class name.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is not included in the DOM specification?

A

The DOM does not define:

  • How documents are represented in binary form.
  • How data is stored or persisted.
  • The semantics or meaning of HTML or XML elements.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly