mirror of
https://github.com/zaphar/wasm-web-components.git
synced 2025-07-21 19:40:30 -04:00
Add the observed event handlers to the shadowRoot
If it exists then add it there. Otherwise add it to the custom element itself.
This commit is contained in:
parent
bb60556f29
commit
8ce79d34a5
@ -144,8 +144,15 @@ fn expand_wc_struct_trait_shim(
|
|||||||
super();
|
super();
|
||||||
this._impl = impl();
|
this._impl = impl();
|
||||||
this._impl.init_impl(this);
|
this._impl.init_impl(this);
|
||||||
|
var self = this;
|
||||||
|
if (self.shadowRoot) {{
|
||||||
for (const t of this.observedEvents()) {{
|
for (const t of this.observedEvents()) {{
|
||||||
this.addEventListener(t, function(evt) {{ this.handleComponentEvent(evt); }} );
|
self.shadowRoot.addEventListener(t, function(evt) {{ self.handleComponentEvent(evt); }} );
|
||||||
|
}}
|
||||||
|
}} else {{
|
||||||
|
for (const t of self.observedEvents()) {{
|
||||||
|
self.addEventListener(t, function(evt) {{ self.handleComponentEvent(evt); }} );
|
||||||
|
}}
|
||||||
}}
|
}}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@ version = "0.3"
|
|||||||
version = "0.3"
|
version = "0.3"
|
||||||
features = [
|
features = [
|
||||||
"CustomElementRegistry",
|
"CustomElementRegistry",
|
||||||
|
"CustomEvent",
|
||||||
"Document",
|
"Document",
|
||||||
"KeyboardEvent",
|
|
||||||
"Event",
|
"Event",
|
||||||
"EventTarget",
|
"EventTarget",
|
||||||
"Element",
|
"Element",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user