Skip to content

Commit

Permalink
fix(lib): fix valyrian adding v- event handlers and direct dom handlers
Browse files Browse the repository at this point in the history
Valyrian was adding the v- event handlers but after update the dom it was adding the direct dom
handler like v-onclick and dom onclick. It must only add the v- event handler.
  • Loading branch information
Masquerade-Circus committed Jul 30, 2021
1 parent 6e19314 commit 6a89654
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,15 @@ function valyrian(): Valyrian {
if (prop in directives) {
return directives[prop](newVnode.props[prop], newVnode, oldVnode);
}
} else if (typeof newVnode.props[prop] === "function" && newVnode.dom[`v-${prop}`] === undefined) {
if (attachedListeners.indexOf(prop) === -1) {
(mainContainer as DomElement).addEventListener(prop.slice(2), eventListener);
attachedListeners.push(prop);
}
} else if (typeof newVnode.props[prop] === "function") {
if (newVnode.dom[`v-${prop}`] === undefined) {
if (attachedListeners.indexOf(prop) === -1) {
(mainContainer as DomElement).addEventListener(prop.slice(2), eventListener);
attachedListeners.push(prop);
}

newVnode.dom[`v-${prop}`] = newVnode.props[prop];
newVnode.dom[`v-${prop}`] = newVnode.props[prop];
}
} else if (prop in newVnode.dom && !newVnode.isSVG) {
// eslint-disable-next-line eqeqeq
if (newVnode.dom[prop] != newVnode.props[prop]) {
Expand Down

0 comments on commit 6a89654

Please sign in to comment.