惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
F
Fortinet All Blogs
J
Java Code Geeks
Y
Y Combinator Blog
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
M
MIT News - Artificial intelligence
腾讯CDC
Last Week in AI
Last Week in AI
The Cloudflare Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Jina AI
Jina AI
Microsoft Security Blog
Microsoft Security Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
P
Proofpoint News Feed
博客园 - 叶小钗
Recent Announcements
Recent Announcements
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
人人都是产品经理
人人都是产品经理
L
LangChain Blog
博客园 - 司徒正美
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Content Virtualization using the HTML <template> Element
Burton Smith · 2026-06-02 · via DEV Community
Cover image for Content Virtualization using the HTML <template> Element

Burton Smith

When I started this experiment, the core question was simple:

Because content inside <template> is inert, can I page HTML into templates and add/remove it from the DOM to improve performance while still making it available for bots and content scrapers?

The answer is yes, but with important caveats.


The Four Approaches

I built four tests around the same dataset of 100,000 items and compared how they behave when rendering a very large list of rich rows.

  1. No Virtualization
  2. Paged Templates
  3. JS Virtualization
  4. Lazy Paged Templates

Each demo represents a different tradeoff between startup cost, live DOM size, implementation complexity, content visibility, and crawler/scraper behavior.


1. No Virtualization

Demo: No Virtualization

This is the baseline worst case: all rows are shipped in the initial HTML and remain live in the DOM.

Pros

  • Simplest implementation
  • All content is immediately available in the document
  • Best fit for raw HTML inspection, non-JS scraping, and source-based AI analysis
  • Most reliable for SEO and indexing

Cons

  • Worst startup cost
  • Largest live DOM
  • Highest memory pressure
  • Worst scrolling/layout/style recalculation behavior
  • Scales poorly as rows become richer

Takeaway

This is the best option for maximum content visibility, but the worst for browser performance at large scale.


2. Paged Templates

Demo: Paged Templates

This version ships all rows in the initial HTML, but stores most of them inside <template> elements so they stay inert until mounted.

Pros

  • Reduces live DOM pressure
  • Keeps markup HTML-first
  • Lets you page content into the DOM only when needed
  • In our simple AI parsing test, it exposed content as well as normal HTML

Cons

  • Large initial HTML still has to be downloaded and parsed
  • Inert content is not free: it still contributes to document size
  • Startup cost remains high if the whole dataset ships up front
  • SEO behavior is still less predictable than normal rendered HTML because <template> content is inert and not normally rendered page content.

Takeaway

Template virtualization is viable, but it improves runtime DOM cost more than startup cost. In this test, AI parsing behaved much better than expected because the static source still contained the inert template content.


3. JS Virtualization

Demo: JS Virtualization

This version keeps the data in JavaScript and reuses a small pool of row nodes while scrolling.

Pros

  • Best startup behavior in the tests
  • Small initial HTML document
  • Low live DOM size
  • Efficient scrolling because a fixed pool of nodes is recycled
  • Usually the strongest choice for app-style UI performance

Cons

  • Requires more client-side logic
  • Content is not fully present in the initial HTML
  • Weakest option for non-JS scraping and source-based analysis
  • Less reliable for SEO unless paired with SSR, prerendering, or crawlable paginated routes

Takeaway

If the goal is browser UI performance, this is usually the strongest default. If the goal is content discoverability, it is usually the weakest.


4. Lazy Paged Templates

Demo: Lazy Paged Templates

This version keeps the template model, but creates template pages after the initial page loads instead of shipping them all up front.

Pros

  • Keeps the benefits of template-backed paging
  • Avoids the worst startup cost of a giant template-filled HTML document
  • Improves responsiveness by spreading work over time
  • Better template-based compromise than shipping every template up front

Cons

  • More complex than static templates
  • Still eventually creates lots of inert markup if you keep building pages
  • Still JS-driven
  • SEO/scraping visibility is weaker than static HTML because much of the content appears after initial load

Takeaway

This is the most interesting template-based approach I tested. It keeps the inert template idea while avoiding the biggest flaw of the static template version, but it is still less reliable than plain HTML for indexing and scraping.


Performance vs SEO vs scraping vs AI analysis

Here is the practical ranking from this experiment:

Approach Browser performance SEO / indexing Basic scraping Source-based AI analysis
No Virtualization Worst Best Best Best
Paged Templates Better than full live DOM, but still heavy at startup Mixed-to-good Good Good
JS Virtualization Best Weakest Weakest Weakest
Lazy Paged Templates Better startup than static templates Mixed-to-weak Weak Weak

What this means

  • If your priority is browser performance, JS Virtualization usually wins.
  • If your priority is SEO, indexing, content scraping, or AI systems that inspect raw page source, No Virtualization is the strongest choice.
  • If you want some HTML-first benefits while reducing active DOM size, Paged Templates can be surprisingly effective for AI parsing and basic scraping because the static response still contains the template content.
  • If you want the template model without paying the full startup cost immediately, Lazy Paged Templates are a better direction than shipping every template up front.

AI parsing

I ran a simple AI discoverability test against each example.

I asked the AI (claude code and copilot) how many times it could find the name "Avery Adams" on the page. The correct answer is 391.

Example Correctly counted names
No Virtualization
Paged Templates
JS Virtualization
Lazy Paged Templates

This result was notable because AI systems often use tools like curl to inspect a page's static response. In this case, the AI did not appear to ignore content inside <template> tags. That made Paged Templates much more discoverable to source-based AI analysis than a pure JS-rendered approach.

The lazy template version did not fare as well, because much of its content is created after the initial response rather than being present in the original HTML source.

What this suggests

  • No Virtualization remains the clearest and most reliable option for AI parsing.
  • Paged Templates may be more AI-discoverable than many people expect, as long as the template content is present in the static HTML.
  • JS Virtualization is a poor fit when you want AI systems to understand the full content from the initial page source.
  • Lazy Paged Templates improve startup performance, but that same laziness reduces what source-based tools can see.

Conclusion

Template virtualization could be a viable approach to improve performance and still make content available for static analysis, but it may not be the best tool for it.

  • No Virtualization: best for visibility, worst for scale
  • Paged Templates: better runtime DOM behavior, still expensive upfront, but stronger for AI parsing than expected
  • JS Virtualization: best overall UI performance
  • Lazy Paged Templates: best template-based startup compromise, but weaker for source-visible discovery