Skip to content

Instantly share code, notes, and snippets.

@jamesmosier
Created January 31, 2020 21:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesmosier/e8acc1c744be7b391f13dc2067514f70 to your computer and use it in GitHub Desktop.
Save jamesmosier/e8acc1c744be7b391f13dc2067514f70 to your computer and use it in GitHub Desktop.
Get all heading styles on a page
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