diff --git a/www/js/script.js b/www/js/script.js index 231c6da..ac4bf34 100644 --- a/www/js/script.js +++ b/www/js/script.js @@ -1,18 +1,68 @@ // https://www.geeksforgeeks.org/html/difference-between-domcontentloaded-and-load-events/ // Performance for my useCase (modify NAV and FOOTER) - +// https://stackoverflow.com/questions/44329324/cannot-read-property-symbolsymbol-iterator-of-undefined +/* document.addEventListener("DOMContentLoaded", function(e) { console.log("DOMContentLoaded triggered !"); - // for (document.querySelector("nav") - }); + var topEl = document.getElementsByTagName("nav"); // maybe header + var listLI = topEl[0].getElementsByTagName("li"); + + +document.getElementById(""); + // var allA = listLI.getElementsByTagName("a"); +// topEl. + +listLI.forEach(nodeLI => {console.log(nodeLI.innerHTML);}); +*/ +/* +allA.forEach(node => { + console.log(node); +}); + +*/ +/* + // let myNav = document.getElementsByTagName("nav"); + // myNav.getElementsByTagName("a") + for (child of allA){ + console.log(child.innerHTML); + } +*/ // for (document.querySelector("nav") +// }); + + +/*!SECTION + +// .textContent +// .innerHTML + + +const parent = document.getElementById("myParent"); +const children = parent.children; + +for (let i = 0; i < children.length; i++) { + const child = children[i]; + // Perform actions on the child element + console.log(child.textContent); +} + + +for (let i = 0; i < children.length; i++) { + const child = children[i]; + // Perform actions on the child element + console.log(child.TagName); +console.log(child.textContent);… + + +*/ // javascript console output DOM tree // https://stackoverflow.com/questions/50305257/how-to-console-log-entire-html-dom-tree-in-order-with-attribute-names // https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker +/* var walker = document.createTreeWalker( document.documentElement, NodeFilter.SHOW_ELEMENT // only elements @@ -25,7 +75,7 @@ while (walker.nextNode()) { [...current.attributes].map(({value,name}) => `${name}=${value}`).join() ); } - +*/ // Needed for image loaded and fetched : Not on local computer. /* https://www.geeksforgeeks.org/html/difference-between-domcontentloaded-and-load-events/