<dy-compartment>

用于隔离元素样式,避免用户提交的内容影响内部元素。

const style = css`
  * {
    color: red;
  }
`;

html`
  <dy-compartment
    .styles=${style}
    .content=${html`<div>test</div>`}
  ></dy-compartment>
`;

<dy-compartment> API

DuoyunCompartmentElement

Extends TapCompartmentElement

TapCompartmentElement

Shadow DOM; Extends GemUnsafeElement

TapCompartmentElement Instance Properties

Property(Attribute) Reactive Type
content Yes string | number | TemplateResult | Element | Element[]