184

GitHub - developit/preact-shadow-root: ? Render a Preact subtree into the Shadow...

 6 years ago
source link: https://github.com/developit/preact-shadow-root
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

developit/preact-shadow-root

master

Go to file

Code

Files

Permalink

Latest commit message
Commit time
January 19, 2018 22:47
January 19, 2018 15:54
January 19, 2018 22:48

preact-shadow-root

A tiny <Shadow> component that renders its children into the Shadow DOM.

fireJSFiddle Demo

Usage

import Shadow from 'preact-shadow-root'

const Demo = () => (
  <div class="foo">
    <Shadow>
      <div class="foo">
        I am rendered into the Shadow DOM.
        <style>{`
          .foo {
            border: 2px solid red;
          }
        `}</style>
      </div>
    </Shadow>
  </div>
)

In the above demo, only the <div class="foo"> within <Shadow> will be given a red border.


License

MIT License © Jason Miller


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK