From 9747f74a544f4a829360055d391664978647ef7a Mon Sep 17 00:00:00 2001 From: jin Date: Fri, 3 Nov 2023 02:07:18 +0300 Subject: [PATCH] $mol_view: prevent race condition for mol_theme between host and plugin. $mol_plugin: return static attrs --- dom/render/attributes/attributes.ts | 6 +++++- plugin/plugin.ts | 7 +------ view/view/view.ts | 3 +-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/dom/render/attributes/attributes.ts b/dom/render/attributes/attributes.ts index 644aaa13612..67f8c1f30ec 100644 --- a/dom/render/attributes/attributes.ts +++ b/dom/render/attributes/attributes.ts @@ -9,7 +9,11 @@ namespace $ { let val = attrs[ name ] as any - if( val === null || val === false ) { + if( val === undefined ) { + + continue + + } if( val === null || val === false ) { if( !el.hasAttribute( name ) ) continue diff --git a/plugin/plugin.ts b/plugin/plugin.ts index 31587a0c46c..9e444494ad2 100644 --- a/plugin/plugin.ts +++ b/plugin/plugin.ts @@ -3,12 +3,7 @@ namespace $ { export class $mol_plugin extends $mol_view { override dom_node_external( next? : Element ) { - const host = $mol_owning_get>( this )!.host! - return next ?? host.dom_node() - } - - override attr_static() : { [ key : string ] : string|number|boolean } { - return {} + return next ?? $mol_owning_get>( this )!.host!.dom_node() } override render() { diff --git a/view/view/view.ts b/view/view/view.ts index 1ad7d2ff4dd..e6f6ef04f4e 100644 --- a/view/view/view.ts +++ b/view/view/view.ts @@ -262,7 +262,6 @@ namespace $ { const attr = this.attr() const style = this.style() - const fields = this.field() $mol_dom_render_attributes( node , attr ) $mol_dom_render_styles( node , style ) @@ -386,7 +385,7 @@ namespace $ { attr() { return { - mol_theme: this.theme(), + mol_theme: this.theme() || undefined, } as {} }