Skip to content

Instantly share code, notes, and snippets.

View olibooty's full-sized avatar
🔥

Oli Booty olibooty

🔥
  • Somerset, UK
View GitHub Profile
@olibooty
olibooty / checkForUndefinedCSSClasses.js
Last active June 18, 2021 09:55 — forked from broofa/checkForUndefinedCSSClasses.js
ES module for detecting undefined CSS classes (uses mutation observer to monitor DOM changes). `console.warn()`s undefined classes.
/**
* Sets up a DOM MutationObserver that watches for elements using undefined CSS
* class names. Performance should be pretty good, but it's probably best to
* avoid using this in production.
*
* Usage:
*
* import cssCheck from './checkForUndefinedCSSClasses.js'
*
* // Call before DOM renders (e.g. in <HEAD> or prior to React.render())