🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@webcomponents/template-shadowroot

Package Overview
Dependencies
Maintainers
4
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webcomponents/template-shadowroot

Declarative Shadow DOM for SSR

0.2.1
latest
Source
npm
Version published
Weekly downloads
7.4K
24.38%
Maintainers
4
Weekly downloads
 
Created
Source

Declarative Shadow DOM Ponyfill

Declarative Shadow DOM for SSR

A ponyfill of the API described by Mason Freed at https://github.com/mfreed7/declarative-shadow-dom.

Overview

This package provides a function, hydrateShadowRoots, that converts <template> elements with a shadowrootmode attribute into ShadowRoots on the template's parent element.

This allows HTML with shadow roots to be serialized to plain HTML, and the serialized shadow roots "rehydrated" (separate from component hydration) on the client.

<template shadowrootmode> elements are transformed bottom up so that in the case where they're nested, all elements within the declarative shadow tree stay inert until they have all been moved from their <template shadowrootmode> elements.

If native support for <template shadowrootmode> is present, hydrateShadowRoots does nothing when called.

Known limitations

  • Does not currently look into imperatively created shadow roots.
  • The mutation observer implementation
    • May not work properly in the face of streaming HTML parsing. Needs investigation.
    • Will not notice imperatively created <template shadowrootmode> elements inside of other shadow roots.
  • Not enough benchmarks, and benchmarks of insufficient quality to be confident of good performance.

FAQs

Package last updated on 17 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts