Skip to content

Commit bda5c5a

Browse files
committed
fix: correct method name for retrieving element value and enhance state attribute handling
1 parent f6eb661 commit bda5c5a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/index.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ async function stateAttributes(element) {
133133
if (element.hasAttribute("state_to")) elements.push(element);
134134
let nestedElements = element.querySelectorAll("[state_to]");
135135
elements.push(...nestedElements);
136+
let current = element;
137+
while (current) {
138+
if (current.hasAttribute("state_to") && !elements.includes(current)) {
139+
elements.push(current);
140+
}
141+
current = current.parentElement;
142+
}
136143
// }
137144

138145
let changeState = false;
@@ -187,7 +194,7 @@ async function _getAttributeValues(element) {
187194
});
188195
else if (attribute.name == "state-value" && !attribute.value)
189196
Object.assign(attributeValues, {
190-
value: await element.getvalue()
197+
value: await element.getValue()
191198
});
192199
else
193200
Object.assign(attributeValues, {
@@ -200,7 +207,7 @@ async function _getAttributeValues(element) {
200207
!element.hasAttribute("state-value") &&
201208
element.getvalue
202209
)
203-
Object.assign(attributeValues, { value: await element.getvalue() });
210+
Object.assign(attributeValues, { value: await element.getValue() });
204211

205212
return attributeValues;
206213
}

0 commit comments

Comments
 (0)