Skip to content

Instantly share code, notes, and snippets.

@jamesmosier
jamesmosier / headingStyles.js
Created January 31, 2020 21:59
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)
};