diff --git a/src/Mite.js b/src/Mite.js index 9501780..18c9b89 100644 --- a/src/Mite.js +++ b/src/Mite.js @@ -107,8 +107,9 @@ export class Mite { try { const handler = new Function( "event", - `with (this.data) { ${exprContent}; }` + `with (this.data) { ${exprContent.replace(/(\w+)/g, (match) => this.data[match] ? `${match}.value` : match)}; }` ).bind(this); + node.addEventListener(eventName, handler); } catch (e) { console.error(`Invalid expression in ${attr.name}: ${exprContent}`, e);