Merge pull request #733 from trheyi/main
chore: Update __Query class to accept both string and Element types f…
This commit is contained in:
commit
b43051b1ce
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.root = %s;
|
||||||
this.store = new __sui_store(this.root);
|
this.store = new __sui_store(this.root);
|
||||||
this.props = new __sui_props(this.root);
|
this.props = new __sui_props(this.root);
|
||||||
|
if (this.root.getAttribute("initialized") != 'true') {
|
||||||
if (!this.root.getAttribute("initialized")) {
|
|
||||||
this.root.setAttribute("initialized", 'true');
|
this.root.setAttribute("initialized", 'true');
|
||||||
this.root.addEventListener("state:change", function (event) {
|
this.root.addEventListener("state:change", function (event) {
|
||||||
const name = this.getAttribute("s:cn");
|
const name = this.getAttribute("s:cn");
|
||||||
|
|
|
||||||
|
|
@ -42,13 +42,11 @@ function __sui_state(component) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let parent = component.root.parentElement;
|
let parent = component.root.parentElement?.closest(`[s\\:cn]`);
|
||||||
while (parent && !parent.getAttribute("s:cn")) {
|
if (parent == null) {
|
||||||
parent = parent.parentElement;
|
|
||||||
}
|
|
||||||
if (parent == document.body || parent == null) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dispatch the state change custom event to parent component
|
// Dispatch the state change custom event to parent component
|
||||||
const event = new CustomEvent("state:change", {
|
const event = new CustomEvent("state:change", {
|
||||||
detail: { key: key, value: value, target: component.root },
|
detail: { key: key, value: value, target: component.root },
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue