Réponses
Question A
a : let parent = element.parentElement;
b,c : parent
b,c : parent
d : parent.classList.add(className);
e : parent = parent.parentElement;
e : parent = parent.parentElement;
Question B
tab = [];
function run(n, selector) {
if (n.matches(selector)) {tab.push(n);}
for (let childElt of n.children) {
run(childElt, selector);
}}
function run(n, selector) {
if (n.matches(selector)) {tab.push(n);}
for (let childElt of n.children) {
run(childElt, selector);
}}
Question C
images.addEventListener("click", (e) => {
if (e.target.nodeName == "P")
e.target.closest("article").querySelector("img").toggleAttribute("hidden");
},false);