Created
December 27, 2018 12:44
-
-
Save tanhauhau/aaed4db28f4f1a446e9133384a816cb7 to your computer and use it in GitHub Desktop.
Finding dom element within the region
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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