Created
January 31, 2020 21:59
-
-
Save jamesmosier/e8acc1c744be7b391f13dc2067514f70 to your computer and use it in GitHub Desktop.
Get all heading styles on a page
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
var headings = ['h1','h2','h3', 'h4', 'h5','h6']; | |
function onlyUnique(value, index, self) { | |
return self.indexOf(value) === index; | |
} | |
headings.map(heading => { | |
return { | |
[heading]: [...document.querySelectorAll(heading)].map(item => window.getComputedStyle(item).fontSize).filter(onlyUnique) | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment