Conteúdo do Curso
Advanced JavaScript Mastery
Advanced JavaScript Mastery
1. Classes
Welcome to the CourseClass DeclarationChallenge: Building a Class Class MethodsChallenge: Adding Methods to a ClassParameter ObjectPrivate PropertiesChallenge: Implementing Private Properties in a ClassGetters and SettersChallenge: Managing Properties with Getters and SettersStatic PropertiesStatic MethodsChallenge: Using Static Properties and Methods in a ClassInheritance with extends and Using super()Challenge: Class Inheritance with Extends and Using Super
2. DOM Manipulation
What is the DOM?Querying the DOMChallenge: Querying the DOMUnderstanding the DOM HierarchyChallenge: DOM HierarchyDOM PropertiesWorking with Element AttributesChallenge: Working with Element Properties and AttributesAdding ElementsRemoving ElementsChallenge: Adding and Removing ElementsModifying Element StylesChallenge: Modifying Element Styles
Challenge: DOM Hierarchy
Task
You have a simple task list in HTML. Your goal is to navigate through the DOM hierarchy using properties like parentNode
, childNodes
, firstChild
, lastChild
, previousSibling
, and nextSibling
to understand their behavior and how they access different nodes.
- Access the Parent Node: The
<li>
element with the IDcurrent-task
is selected. Access its parent<ul>
element; - Access All Child Nodes: Retrieve all child nodes, including text nodes (like whitespace);
- Access the First and Last Child Nodes:
- Access the first child node on the parent
<ul>
; - Access the last child node on the parent
<ul>
.
- Access the first child node on the parent
- Navigate to Sibling Nodes:
- Access its previous sibling node on
current-task
; - Access its next sibling node on
current-task
.
- Access its previous sibling node on
index.html
index.css
index.js
- Use
parentNode
to access its parent<ul>
element. - Use
childNodes
on the parent<ul>
to retrieve all child nodes, including text nodes (like whitespace); - Use
firstChild
on the parent<ul>
to access the first child node; - Use
lastChild
on the parent<ul>
to access the last child node; - Use
previousSibling
oncurrent-task
to access its previous sibling node; - Use
nextSibling
oncurrent-task
to access its next sibling node.
index.html
index.css
index.js
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 2. Capítulo 5