redo #1595
This commit is contained in:
parent
d21bfd4a36
commit
4616160a52
2 changed files with 21 additions and 10 deletions
|
|
@ -480,12 +480,23 @@ module.exports = function($window) {
|
|||
else if (key[0] === "o" && key[1] === "n" && typeof value === "function") updateEvent(vnode, key, value)
|
||||
else if (key === "style") updateStyle(element, old, value)
|
||||
else if (key in element && !isAttribute(key) && ns === undefined && !isCustomElement(vnode)) {
|
||||
//setting input[value] to same value by typing on focused element moves cursor to end in Chrome
|
||||
if (vnode.tag === "input" && key === "value" && vnode.dom.value == value && vnode.dom === $doc.activeElement) return
|
||||
//setting select[value] to same value while having select open blinks select dropdown in Chrome
|
||||
if (vnode.tag === "select" && key === "value" && vnode.dom.value == value && vnode.dom === $doc.activeElement) return
|
||||
//setting option[value] to same value while having select open blinks select dropdown in Chrome
|
||||
if (vnode.tag === "option" && key === "value" && old != null && vnode.dom.value == value) return
|
||||
if (key === "value") {
|
||||
/*eslint-disable no-implicit-coercion*/
|
||||
var normalized = "" + value
|
||||
/*eslint-enable no-implicit-coercion*/
|
||||
//setting input[value] to same value by typing on focused element moves cursor to end in Chrome
|
||||
if (vnode.tag === "input" && vnode.dom.value === normalized && vnode.dom === $doc.activeElement) return
|
||||
//setting select[value] to same value while having select open blinks select dropdown in Chrome
|
||||
if (vnode.tag === "select") {
|
||||
if (value === null) {
|
||||
if (vnode.dom.selectedIndex === -1 && vnode.dom === $doc.activeElement) return
|
||||
} else {
|
||||
if (old !== null && vnode.dom.value === normalized && vnode.dom === $doc.activeElement) return
|
||||
}
|
||||
}
|
||||
//setting option[value] to same value while having select open blinks select dropdown in Chrome
|
||||
if (vnode.tag === "option" && old != null && vnode.dom.value === normalized) return
|
||||
}
|
||||
// If you assign an input type that is not supported by IE 11 with an assignment expression, an error will occur.
|
||||
if (vnode.tag === "input" && key === "type") {
|
||||
element.setAttribute(key, value)
|
||||
|
|
|
|||
|
|
@ -203,10 +203,10 @@ o.spec("attributes", function() {
|
|||
|
||||
o(b.dom.value).equals("")
|
||||
|
||||
// #1595 redux
|
||||
render(root, [c]);
|
||||
// #1595 redux
|
||||
render(root, [c]);
|
||||
|
||||
o(c.dom.value).equals("0")
|
||||
o(c.dom.value).equals("0")
|
||||
})
|
||||
o("isn't set when equivalent to the previous value and focused", function() {
|
||||
var $window = domMock({spy: o.spy})
|
||||
|
|
@ -476,7 +476,7 @@ o.spec("attributes", function() {
|
|||
|
||||
o(a.dom.value).equals("")
|
||||
|
||||
// #1595 redux
|
||||
// #1595 redux
|
||||
render(root, [b])
|
||||
|
||||
o(b.dom.value).equals("0")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue