Giter Club home page Giter Club logo

template-shadowroot's Introduction

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 shadowroot 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 shadowroot> 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 shadowroot> elements.

If native support for <template shadowroot> 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 shadowroot> elements inside of other shadow roots.
  • Not enough benchmarks, and benchmarks of insufficient quality to be confident of good performance.

template-shadowroot's People

Contributors

rictic avatar justinfagnani avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.