Le classique "Trier"

 https://github.com/dupontdenis/tri.git

L'idée est de trié un tableau en mémoire et de repercuter sur le DOM le changement.


https://dupontdenis.github.io/tri/

composedPath().

 


document.body.addEventListener("click", (eventObject) => { let tabulation = "".padEnd(eventObject.composedPath().length, "▶️"); eventObject.composedPath().forEach((elt) => { document.body.insertAdjacentHTML( "beforeEnd", `<p>Clicked on: ${tabulation} ${elt.nodeName ? elt.nodeName : "Window"}` ); tabulation = tabulation.slice(0, -1); }); });


See the Pen Untitled by dupont (@dupontcodepen) on CodePen.