chore: Update __Query class to accept both string and Element types for selector
This commit is contained in:
parent
197b155280
commit
2a19ef857b
3 changed files with 64 additions and 67 deletions
120
data/bindata.go
120
data/bindata.go
File diff suppressed because one or more lines are too long
|
|
@ -115,8 +115,7 @@ const componentInitScriptTmpl = `
|
|||
this.root = %s;
|
||||
this.store = new __sui_store(this.root);
|
||||
this.props = new __sui_props(this.root);
|
||||
|
||||
if (!this.root.getAttribute("initialized")) {
|
||||
if (this.root.getAttribute("initialized") != 'true') {
|
||||
this.root.setAttribute("initialized", 'true');
|
||||
this.root.addEventListener("state:change", function (event) {
|
||||
const name = this.getAttribute("s:cn");
|
||||
|
|
|
|||
|
|
@ -42,13 +42,11 @@ function __sui_state(component) {
|
|||
return;
|
||||
}
|
||||
|
||||
let parent = component.root.parentElement;
|
||||
while (parent && !parent.getAttribute("s:cn")) {
|
||||
parent = parent.parentElement;
|
||||
}
|
||||
if (parent == document.body || parent == null) {
|
||||
let parent = component.root.parentElement?.closest(`[s\\:cn]`);
|
||||
if (parent == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Dispatch the state change custom event to parent component
|
||||
const event = new CustomEvent("state:change", {
|
||||
detail: { key: key, value: value, target: component.root },
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue