Skip to content

Commit

Permalink
fix: handle input type not being specified closes #2229
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Aug 25, 2019
1 parent d46f61f commit 8bfe9eb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/utils/vnode.ts
Expand Up @@ -5,6 +5,11 @@ import Vue, { VNode, VNodeDirective } from 'vue';
export const isTextInput = (vnode: VNode): boolean => {
const attrs = (vnode.data && vnode.data.attrs) || vnode.elm;

// it will fallback to being a text input per browsers spec.
if (vnode.tag === 'input' && (!attrs || !attrs.type)) {
return true;
}

return includes(['text', 'password', 'search', 'email', 'tel', 'url', 'textarea', 'number'], attrs && attrs.type);
};

Expand Down Expand Up @@ -150,7 +155,7 @@ export function getInputEventName(vnode: VNode, model?: VNodeDirective): string
}

// is a textual-type input.
if (vnode.data && vnode.data.attrs && isTextInput(vnode)) {
if (isTextInput(vnode)) {
return 'input';
}

Expand Down

0 comments on commit 8bfe9eb

Please sign in to comment.