Skip to content

Commit

Permalink
fix:only input[text/password] && textarea element need change onchang…
Browse files Browse the repository at this point in the history
…e event to oninput event
  • Loading branch information
luckyadam committed Nov 24, 2017
1 parent afe79b6 commit 912f001
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/vdom/create-element.ts
Expand Up @@ -74,15 +74,17 @@ function createElement (vnode: VirtualNode, isSvg?: boolean): Element | Text | C
}

function setProps (domNode: Element, props: IProps, isSvg?: boolean) {
const hooks:any = []
for (const p in props) {
if (p === 'children') {
continue
}
const propValue = props[p]
if (isHook(propValue)) {
if (propValue.hook) {
propValue.hook(domNode, p)
}
hooks.push({
hook: propValue,
prop: p
})
continue
} else if (p === 'style') {
if (isString(propValue)) {
Expand Down Expand Up @@ -132,6 +134,14 @@ function setProps (domNode: Element, props: IProps, isSvg?: boolean) {
}
}
}
if (hooks.length) {
hooks.forEach(item => {
const hookItem = item.hook
if (hookItem.hook) {
hookItem.hook(domNode, item.prop)
}
})
}
}

export default createElement

0 comments on commit 912f001

Please sign in to comment.