mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-20 10:47:35 -05:00
Remove redundant .shadow property as that is defined at the Custom Element level. (#1395)
This commit is contained in:
committed by
GitHub
parent
8590c7e5b8
commit
0021ccb49f
@@ -8,7 +8,6 @@ const logger = getLogger('py-register-widget');
|
||||
|
||||
function createWidget(interpreter: InterpreterClient, name: string, code: string, klass: string) {
|
||||
class CustomWidget extends HTMLElement {
|
||||
shadow: ShadowRoot;
|
||||
wrapper: HTMLElement;
|
||||
|
||||
name: string = name;
|
||||
@@ -20,11 +19,8 @@ function createWidget(interpreter: InterpreterClient, name: string, code: string
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
// attach shadow so we can preserve the element original innerHtml content
|
||||
this.shadow = this.attachShadow({ mode: 'open' });
|
||||
|
||||
this.wrapper = document.createElement('slot');
|
||||
this.shadow.appendChild(this.wrapper);
|
||||
this.attachShadow({ mode: 'open' }).appendChild(this.wrapper);
|
||||
}
|
||||
|
||||
async connectedCallback() {
|
||||
@@ -45,7 +41,6 @@ function createWidget(interpreter: InterpreterClient, name: string, code: string
|
||||
|
||||
export function make_PyWidget(interpreter: InterpreterClient) {
|
||||
class PyWidget extends HTMLElement {
|
||||
shadow: ShadowRoot;
|
||||
name: string;
|
||||
klass: string;
|
||||
outputElement: HTMLElement;
|
||||
@@ -58,11 +53,8 @@ export function make_PyWidget(interpreter: InterpreterClient) {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
// attach shadow so we can preserve the element original innerHtml content
|
||||
this.shadow = this.attachShadow({ mode: 'open' });
|
||||
|
||||
this.wrapper = document.createElement('slot');
|
||||
this.shadow.appendChild(this.wrapper);
|
||||
this.attachShadow({ mode: 'open' }).appendChild(this.wrapper);
|
||||
|
||||
this.addAttributes('src', 'name', 'klass');
|
||||
}
|
||||
|
||||
@@ -242,7 +242,6 @@ type PyElementClass = (htmlElement: HTMLElement) => PyElementInstance;
|
||||
export function define_custom_element(tag: string, pyElementClass: PyElementClass): any {
|
||||
logger.info(`creating plugin: ${tag}`);
|
||||
class ProxyCustomElement extends HTMLElement {
|
||||
shadow: ShadowRoot;
|
||||
wrapper: HTMLElement;
|
||||
pyElementInstance: PyElementInstance;
|
||||
originalInnerHTML: string;
|
||||
@@ -251,9 +250,8 @@ export function define_custom_element(tag: string, pyElementClass: PyElementClas
|
||||
logger.debug(`creating ${tag} plugin instance`);
|
||||
super();
|
||||
|
||||
this.shadow = this.attachShadow({ mode: 'open' });
|
||||
this.wrapper = document.createElement('slot');
|
||||
this.shadow.appendChild(this.wrapper);
|
||||
this.attachShadow({ mode: 'open' }).appendChild(this.wrapper);
|
||||
this.originalInnerHTML = this.innerHTML;
|
||||
this.pyElementInstance = pyElementClass(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user