JS & SSR Updated 2026-11-16 3 min read Google WRS · Web Components · Shadow DOM

Shadow DOM, Web Components & Iframes: How Googlebot Flattens Encapsulated Copy

Embedding pricing tables inside third-party iframes or closed Shadow DOM roots prevents search engines from attributing that content to your URL.

Dmitry K., Technical SEO Lead · SEO Space

Indexation benchmark targets

Shadow mode
Open / Declarative only
Core copy in iframe
0% (inline SSR HTML)
Slot attribution
Light DOM semantic tags

How Google WRS Handles Open vs. Closed Shadow DOM

During headless Chromium rendering, Google Web Rendering Service flattens Light DOM and Open Shadow DOM trees into a unified document snapshot so custom elements can be indexed. However, client-only Web Components still stall until JS execution finishes, and `mode: "closed"` encapsulates internals tightly enough to risk partial omission.

The cleanest pattern places primary SEO headings, paragraphs, and `<a>` links inside Light DOM slots, reserving Shadow DOM purely for isolated visual widgets.

  • Keep `<h1>`, `<h2>`, product descriptions, and internal anchors in Light DOM slots.
  • Adopt Declarative Shadow DOM (`<template shadowrootmode="open">`) so SSR emits styled markup before hydration.
  • Verify flattened text inside Google Search Console URL Inspection -> View Tested Page HTML.

Why Iframes Split Authority & Fail Commercial Attribution

Content loaded via `<iframe src="https://vendor.app/reviews">` belongs strictly to the vendor’s origin—search engines generally index the framed resource separately rather than merging its keywords or reviews into your parent URL.

Replace SaaS booking iframes, review widgets, and comparison calculators with server-fetched HTML fragments or JSON API hydration rendered natively inside your page DOM.

<!-- Declarative Shadow DOM rendered immediately via SSR -->
<pricing-card>
  <template shadowrootmode="open">
    <style>:host { display: block; }</style>
    <slot name="title"></slot>
    <slot name="price"></slot>
  </template>
  <h3 slot="title">Enterprise SEO Setup</h3>
  <span slot="price">$1,200</span>
</pricing-card>

Validating Flattened DOM Parity Across Bots

Unlike Google WRS, lighter crawlers and AI fetchers (including GPTBot and PerplexityBot) typically read raw HTTP responses without executing custom element constructors. Light DOM slotting + Declarative Shadow DOM protects both classic search and AI retrieval simultaneously.

Encapsulation Pattern Raw Fetch Bots / AI Google WRS Rendering
Cross-origin <iframe> Invisible on parent page Indexed separately on third-party origin
Client-only Closed Shadow DOM Invisible (empty tag) High risk of incomplete extraction
Light DOM Slots + Declarative Shadow DOM 100% readable in HTML 100% flattened & indexed on parent

Need this indexation setup audited on your domain?

Send your website URL. We check raw HTML parity, log crawl hits, canonical discipline, and sitemap architecture manually within 24 hours.