Search
Collective #517
20.5.2019
Tornis * Folding the DOM * Gitfolio * Devchecklists * A practical guide to JavaScript Proxy
Collective #517 was written by Pedro Botelho and published on Codrops
10 React Challenges (Beginner): DOM Movement with Events
20.5.2019
Styling elements or in some instances, components in a React project is essential. Sometimes, you need to make a change in the style of an element bas
10 React Challenges (Beginner): Use React State to Update the DOM
10.5.2019
A common theme in modern front-end JavaScript libraries/frameworks is that they can help you manage the data in your applications.
Once you update something, React can immediate
10 Days of React Challenges (Beginner): Use React State to Update the DOM
10.5.2019
A common theme in modern front-end JavaScript libraries/frameworks is that they can help you manage the data in your applications.
Once you update something, React can immediate
A Few Functional Uses for Intersection Observer to Know When an Element is in View
8.5.2019
You might not know this, but JavaScript has stealthily accumulated quite a number of observers in recent times, and Intersection Observer is a part of that arsenal. Observers are objects that spot something in real-time — like birdwatchers going to their favorite place to sit and wait for the birds...
Getting To Know The MutationObserver API
8.5.2019
MutationObserver watches the DOM, specifically the places you tell it to, like:
document.querySelector('#watch-this');
...and it can tell you (trigger a callback) when stuff happens — like when a child is added, removed, changed, or a number of other things.
I used it just the other day...
Making Web Components for Different Contexts
2.5.2019
This article isn’t about how to build web components. Caleb Williams already wrote a comprehensive guide about that recently. Let’s talk about how to work with them, what to consider when making them, and how to embrace them in your projects.
If you are new to web components, Caleb’s guide is...
The Power of Named Transitions in Vue
16.4.2019
Vue offers several ways to control how an element or component visually appears when inserted into the DOM. Examples can be fading in, sliding in, or other visual effects. Almost all of this functionality is based around a single component: the transition component.
A simple example of this is with...
Scroll-Linked Animations
29.3.2019
You scroll down to a certain point, now you want to style things in a certain way. A header becomes fixed. An animation triggers. A table of contents appears. To do anything based on scroll position, JavaScript is required right now. You watch the scroll position via a DOM event and alter...
Understanding Event Emitters
26.3.2019
Consider, a DOM Event:
const button = document.querySelector("button");
button.addEventListener("click", (event) => /* do something with the event */)
We added a listener to a button click. We’ve subscribed to an event being emitted and we fire a callback when it does. Every time we click that...
Advanced Tooling for Web Components
22.3.2019
Over the course of the last four articles in this five-part series, we’ve taken a broad look at the technologies that make up the Web Components standards. First, we looked at how to create HTML templates that could be consumed at a later time. Second, we dove into creating our own custom element....
Encapsulating Style and Structure with Shadow DOM
21.3.2019
This is part four of a five-part series discussing the Web Components specifications. In part one, we took a 10,000-foot view of the specifications and what they do. In part two, we set out to build a custom modal dialog and created the HTML template for what would evolve into our very own custom...
Crafting Reusable HTML Templates
19.3.2019
In our last article, we discussed the Web Components specifications (custom elements, shadow DOM, and HTML templates) at a high-level. In this article, and the three to follow, we will put these technologies to the test and examine them in greater detail and see how we can use them in production...
An Introduction to Web Components
18.3.2019
Front-end development moves at a break-neck pace. This is made evident by the myriad articles, tutorials, and Twitter threads bemoaning the state of what once was a fairly simple tech stack. In this article, I’ll discuss why Web Components are a great tool to deliver high-quality user experiences...
Web Standards Meet User-Land: Using CSS-in-JS to Style Custom Elements
15.3.2019
The popularity of CSS-in-JS has mostly come from the React community, and indeed many CSS-in-JS libraries are React-specific. However, Emotion, the most popular library in terms of npm downloads, is framework agnostic.
Using the shadow DOM is common when creating custom elements, but there’s...
Extracting Text from Content Using HTML Slot, HTML Template and Shadow DOM
6.3.2019
Chapter names in books, quotes from a speech, keywords in an article, stats on a report — these are all types of content that could be helpful to isolate and turn into a high-level summary of what's important.
For example, have you seen the way Business Insider provides an article's key points...
<span>L</span><span>e</span><span>t</span><span>t</span><span>e</span><span>r</span><span>s</span>
20.2.2019
Did you see this Facebook crap?
"Why do I need a 4Ghz quadcore to run facebook?" This is why. A single word split up into 11 HTML DOM elements to avoid adblockers. pic.twitter.com/Zv4RfInrL0
— Mike Pan (@themikepan) February 6, 2019
I popped over to Facebook to verify that and what...
Simple Crazy Buttons in VanillaJS (Solution to Code Challenge #15)
11.2.2019
Last week on the code challenge #15 we set out to complete a challenge on manipulating DOM properties
Intro to React Hooks
18.1.2019
Hooks make it possible to organize logic in components, making them tiny and reusable without writing a class. In a sense, they’re React’s way of leaning into functions because, before them, we’d have to write them in a component and, while components have proven to be powerful and functional...
Using React Portals to Render Children Outside the DOM Hierarchy
15.1.2019
Say we need to render a child element into a React application. Easy right? That child is mounted to the nearest DOM element and rendered inside of it as a result.
render() {
return (
<div>
// Child to render inside of the div
</div>
);
}
But! What if we want...