Closed
Description
It should be fairly easy to find inline styles, and it could certainly be very interesting to see their results, but how should they be reported? Inline styles don't have selectors, but merely declarations.
Scraping inline styles from a page:
[...document.querySelectorAll('[style]')].map(el => el.getAttribute('style')).join('')
We could generate a unique selector for each inline style attribute, but it could interfere with the resulting CSS statistics:
const nanoid = require('nanoid')
[...document.querySelectorAll('[style]')].map(el => {
return `[x-inline-style-${nanoid()}] { // create a custom [x-inline-style-*] selector
${el.getAttribute('style')} // contains all declarations
}`
)
Metadata
Metadata
Assignees
Labels
No labels