Skip to content

Commit 78a3925

Browse files
committed
fix: check if dynamic attribute before evaluating it for observeDOM
1 parent 2089454 commit 78a3925

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lib/entity.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,17 @@ export default class Entity {
2828
return !!this.uuid
2929
}
3030

31+
isDynamicAttribute(attr) {
32+
if (!attr.startsWith(':')) return false
33+
if (MiniJS.allCustomBindings.includes(attr)) return false
34+
if (this.allEvents.includes(attr)) return false
35+
return true
36+
}
37+
3138
_getDynamicAttributes() {
3239
for (let i = 0; i < this.element.attributes.length; i++) {
3340
const attr = this.element.attributes[i]
34-
if (MiniJS.allCustomBindings.includes(attr.name)) continue
35-
if (
36-
MiniJS.allEvents.includes(attr.name) ||
37-
this.allEvents.includes(attr.name)
38-
)
39-
continue
40-
if (!attr.name.startsWith(':')) continue
41+
if (!this.isDynamicAttribute(attr.name)) continue
4142
if (this.dynamicAttributes.includes(attr.name)) continue
4243
this.dynamicAttributes.push(attr.name)
4344
}
@@ -273,7 +274,7 @@ export default class Entity {
273274
else if (attribute === ':text') this.evaluateText()
274275
else if ([':value', ':checked'].includes(attribute)) this.evaluateValue()
275276
else if (attribute === ':each') this.evaluateEach()
276-
else {
277+
else if (this.isDynamicAttribute(attribute)) {
277278
if (!this.dynamicAttributes.includes(attribute))
278279
this.dynamicAttributes.push(attribute)
279280
this.evaluateDynamicAttributes()

0 commit comments

Comments
 (0)