Pass shadow dom options down to SvelteElement

pull/2516/head
Zephraph 7 years ago
parent 1d495c8ad1
commit f3d0d2938d

@ -445,11 +445,10 @@ export default function dom(
builder.add_block(deindent`
class ${name} extends @SvelteElement {
constructor(options) {
super();
super(${should_use_shadow_dom ? '' : '{ use_shadow_dom: true }'});
${css.code && should_use_shadow_dom && `this.shadowRoot.innerHTML = \`<style>${escape(css.code, { only_escape_at_symbol: true }).replace(/\\/g, '\\\\')}${options.dev ? `\n/*# sourceMappingURL=${css.map.toUrl()} */` : ''}</style>\`;`}
// TODO: Figure out what target should point to
@init(this, { target: this.shadowRoot }, ${definition}, create_fragment, ${not_equal}, ${prop_names});
${dev_props_check}

@ -115,9 +115,9 @@ export function init(component, options, instance, create_fragment, not_equal, p
export let SvelteElement;
if (typeof HTMLElement !== 'undefined') {
SvelteElement = class extends HTMLElement {
constructor() {
constructor({ use_shadow_dom = true } = {}) {
super();
if (options.shadowDom !== false) {
if (use_shadow_dom) {
this.attachShadow({ mode: 'open' });
}
}

Loading…
Cancel
Save