Skip to content

Commit 037e110

Browse files
kfuledead-claudia
authored andcommitted
[refactor] Limit the condition of the option tag to "selected" attribute in isFormAttribute()
The condition of the option tag is intended to fix #1916 and should be evaluated in conjunction with the "selected" attribute. This commit will improve code readability a bit, reduce the number of times to evaluate tags and also reduce the number of times to set the same attribute in option elements redundantly.
1 parent 7771ece commit 037e110

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

render/render.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ module.exports = function() {
730730
}
731731
}
732732
function isFormAttribute(vnode, attr) {
733-
return attr === "value" || attr === "checked" || attr === "selectedIndex" || attr === "selected" && vnode.dom === activeElement(vnode.dom) || vnode.tag === "option" && vnode.dom.parentNode === activeElement(vnode.dom)
733+
return attr === "value" || attr === "checked" || attr === "selectedIndex" || attr === "selected" && (vnode.dom === activeElement(vnode.dom) || vnode.tag === "option" && vnode.dom.parentNode === activeElement(vnode.dom))
734734
}
735735
function isLifecycleMethod(attr) {
736736
return attr === "oninit" || attr === "oncreate" || attr === "onupdate" || attr === "onremove" || attr === "onbeforeremove" || attr === "onbeforeupdate"

0 commit comments

Comments
 (0)