Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
var elem = document.querySelector("body");
function deepForEachElem (elem, callback) {
Array.from(elem.children || []).forEach(function (el) {
deepForEachElem(el, callback);
deepForEachElem(elem, function (el) {
let width = el.getBoundingClientRect().width;
console.log(width, el);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment