Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var elem = document.querySelector("body");
function deepForEachElem (elem, callback) {
callback(elem);
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
You can’t perform that action at this time.