Read: 06- Probles Domain, Objects and the DOM
- Materials
-
JS Ojb Literals 100-105 / Doc Obj Model 183-242
Obj Literals
1.Objects group togther a set of vars and functions to create a model of something you would recognize. In am obj cariables and functions take new names
-
- Variables become know as properties
- Functions become known as methods
- Literal notation is the easiest way and most popular way to create Objects
DOM
- The DOm specifies how browers should create a model of an HTML page and how JS can accress and update content
- The DOM specifies the way which the browers should structure this model using a DOM tree
- People also call the DOM a Application Programming Interface (API)
- Methods that find elements in the DOM tree are called DOM queries
- getElementById() and querySelector() can both search the document and return individual elements
- When a DOM method can return more than one element it returns a NodeList
- 2 ways to select an element from a NodeList = item() methond and array syntax (perferred)
- When you have a NodeList you can loop through each node and apply the same statments to each
- There are two different ways to add and remove content from a DOM tree, innerHTML property and DOM manipultion
- DOM trees have 4 types of nodes, doc nudes, element nodes, attribute nodes, text nodes
- You can select element nodes by their id or class attribute, tag name, or CSS selector syntax
- When a DOM query can return more than one node it will always return a NodeList
- An element node can you access and update its content using properties like textContent and innerHTML or DOM manipulation
- Element Nodes can contain multiple text nodes and child elements that are siblings of each other
- In older browsers, implementation of the DOM is incosistent
- Browsers offer tools for viewing the DOM tree
Things I want to know more about
- The DOM chapters where alot and confusing. I get how objects work and function but will need to spend more time working the DOM and understanding the documentation. I feel like the book went way indepth and a bit to much, I thought the DOM was the page and using the our developer tools ( the console log ) was actually working with the DOM. I will have to read this chaper again slowly.