0.0.1 • Published 7 years ago

declarative-shadow-dom v0.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

<declarative-shadow-dom>

Custom Element to create Shadow DOM in a declarative manner

Demo

Check it live!

Install

Install the component using Bower:

$ bower install declarative-shadow-dom --save

Or download as ZIP.

Usage

  1. Import polyfill:

    <script src="bower_components/webcomponentsjs/webcomponents.min.js"></script>
  2. Import custom element:

    <link rel="import" href="bower_components/declarative-shadow-dom/declarative-shadow-dom.html">
  3. Start using it!

    <anyelement>
        <template is="declarative-shadow-dom">
            Shadow Content here
            <slot></slot>
        </template>
        Light DOM content here
    </anyelement>

Options

AttributeOptionsDefaultDescription
disabledBooleanfalseif set to true, the element will not stamp itself
stampedBooleanattribute that reflects whether the element is stamped or not, you can change it to stamp or clear the Shadow DOM

Methods

MethodParametersReturnsDescription
appendToParentsShadowRoot()None.Nothing.Appends content to parent element's shadow root, create one if needed.

Events

EventDescription
declarative-shadow-dom-stampedTriggers when Shadow DOM is stamped

Contributing and Development

History

For detailed changelog, check Releases.

License

MIT

0.0.1

7 years ago