34

Quickly Adding Many Elements into the DOM

In this Chapter

  • Learn how to add many elements into the DOM performantly

  • Learn about the DocumentFragment and innerHTML approaches for modifying our DOM

An important part of working with the DOM is learning how to take a bunch of data and turning it into visuals we see onscreen. This general approach of having data drive what we see is a common pattern, especially as our apps get increasingly more dynamic. Let’s take Netflix for example, as shown in Figure 34.1.

images

FIGURE 34.1

Netflix is one of those web apps with a lot of content.

As we navigate through the Netflix app, we see a bunch of thumbnails ...

Get Javascript Absolute Beginner's Guide, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.