Web Development

A Better API for the Intersection and Mutation Observers

In a previous article, I showed you how to refactor the Resize Observer API into something way simpler to use: // From this const observer = new ResizeObserver(observerFn) function observerFn (entries) { for (let entry of entries) { // Do something with each entry } } const element = document.querySelector(‘#some-element’) observer.observe(element); // To this const

A Better API for the Intersection and Mutation Observers Read More »

CSS Cascade Layers Vs. BEM Vs. Utility Classes: Specificity Control

CSS is wild, really wild. And tricky. But let’s talk specifically about specificity. When writing CSS, it’s close to impossible that you haven’t faced the frustration of styles not applying as expected — that’s specificity. You applied a style, it worked, and later, you try to override it with a different style and… nothing, it

CSS Cascade Layers Vs. BEM Vs. Utility Classes: Specificity Control Read More »