element value is not cleared when value valor change to undefined

This commit is contained in:
Fabiano Taioli 2018-02-07 17:46:39 +01:00 committed by Pierre-Yves Gérardy
parent 33ff439c73
commit 83884bdc90
3 changed files with 15 additions and 0 deletions

View file

@ -638,6 +638,10 @@ module.exports = function($window) {
function setAttr(vnode, key, old, value, ns) {
if (key === "key" || key === "is" || isLifecycleMethod(key)) return
if (key[0] === "o" && key[1] === "n") return updateEvent(vnode, key, value)
if (typeof value === "undefined" && key === "value" && old !== value) {
vnode.dom.value = ""
return
}
if ((old === value && !isFormAttribute(vnode, key)) && typeof value !== "object" || value === undefined) return
var element = vnode.dom
if (key.slice(0, 6) === "xlink:") element.setAttributeNS("http://www.w3.org/1999/xlink", key, value)