-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.3.6. Assignment #105
Comments
@dev-experience Idea: Show an example of Live NodeLists I upgraded an example from MDN: const parent = document.getElementById('parent');
let child_nodes = parent.childNodes;
console.log(child_nodes.length); // let's assume "2"
parent.appendChild(document.createElement('div'));
console.log(child_nodes.length); // outputs "3" |
Finally, I almost got a difference between the property In this code snippet <div id="myDIV">
<p>First p element</p>
<p>Second p element</p>
</div> I found this good explanation:
|
An example for a method document.getElementsByTagName('h2').item(1); |
I worked a bit more with DOM and completed a task "Select all diagonal cells". Please check my solution on codepen: https://codepen.io/trifle-on-a-stick/pen/gOwZPzQ |
I picked NodeList to dive deeper. NodeList
There are 2 varieties of
Properties Methods
Above I provided a link to an example where I used it. |
Here is an example how it can be used: Webpage Code snippet export default function () {
const printButtons = document.querySelectorAll('.js-print')
Array.from(printButtons).forEach(btn => {
// Open the print dialog when the button is clicked
btn.addEventListener('click', () => {
window.print()
})
})
// Track print events
window.onbeforeprint = function () {
sendEvent({ type: 'print' })
}
} Explanation technical
Explanation to human beings |
I wrongly estimated that |
Assignment
Work a bit more with the DOM
Instructions
Research the DOM a little more by 'adopting' a DOM element. Visit the MSDN's list of DOM interfaces and pick one. Find it being used on a web site in the web, and write an explanation of how it is used.
Rubric
The text was updated successfully, but these errors were encountered: