Class 1/22 Flashcards
What is the DOM?
The DOM is a W3C (World Wide Web Consortium) standard.
The DOM defines a standard for accessing documents:
“The W3C Document Object Model (DOM) is a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document.”
The W3C DOM standard is separated into 3 different parts:
Core DOM - standard model for all document types
XML DOM - standard model for XML documents
HTML DOM - standard model for HTML documents
What does document.querySelector() return?
Returns the first matching Element node within the node’s subtree. If no matching node is found, null is returned.
How do you modify the text of elements on the DOM?
The textContent property of the Node interface represents the text content of the node and its descendants. .textContent
What arguments does the addEventListener method take?
an event and a function (click, myClickFunction)
Give five examples of JavaScript events that can be listened for.
click, mousemove, contentload, mouseover, keydown
What does document.createElement() take as its argument?