Skip to content

Instantly share code, notes, and snippets.

@tanhauhau
Created December 27, 2018 12:44
Show Gist options
  • Save tanhauhau/aaed4db28f4f1a446e9133384a816cb7 to your computer and use it in GitHub Desktop.
Save tanhauhau/aaed4db28f4f1a446e9133384a816cb7 to your computer and use it in GitHub Desktop.
Finding dom element within the region
// you can use it to search for offending dom elements that causes and extra space
function findElement(conditionCallback) {
return Array.prototype.slice.call(document.body.querySelectorAll('*')).map(
element => ({ rect: element.getBoundingClientRect(), element })
)
.filter(conditionCallback)
.map(element => element.element);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment