Trying to fix #1916 (#1918)

* Trying to fix #1916

* Remove test for rendering select options. Add back after resolving issue #1978.

* Add #1916 fix to change log.

* Revert "Remove test for rendering select options. Add back after resolving issue #1978."

This reverts commit d4c1be7c2319adf744f78ca787485f52be869208.

* Comment on why failing test for #1916 is commented out.
This commit is contained in:
robinchew 2017-11-01 03:37:51 +08:00 committed by Pierre-Yves Gérardy
parent f22d7d4ca9
commit db2a12dec9
3 changed files with 15 additions and 1 deletions

View file

@ -44,6 +44,7 @@
- core: `xlink:href` attributes are now correctly removed
- core: render() function can no longer prevent from changing `document.activeElement` in lifecycle hooks
- render: fixed an ommission that caused `oninit` to be called unnecessarily in some cases [#1992](https://github.com/MithrilJS/mithril.js/issues/1992)
- render: Render state correctly on select change event [#1916](https://github.com/MithrilJS/mithril.js/issues/1916)
---

View file

@ -551,7 +551,7 @@ module.exports = function($window) {
}
}
function isFormAttribute(vnode, attr) {
return attr === "value" || attr === "checked" || attr === "selectedIndex" || attr === "selected" && vnode.dom === $doc.activeElement
return attr === "value" || attr === "checked" || attr === "selectedIndex" || attr === "selected" && vnode.dom === $doc.activeElement || vnode.dom.parentNode === $doc.activeElement
}
function isLifecycleMethod(attr) {
return attr === "oninit" || attr === "oncreate" || attr === "onupdate" || attr === "onremove" || attr === "onbeforeremove" || attr === "onbeforeupdate"

View file

@ -462,6 +462,19 @@ o.spec("attributes", function() {
{tag:"option", attrs: {value: ""}}
]}
}
/* FIXME
This incomplete test is meant for testing #1916.
However it cannot be completed until #1978 is addressed
which is a lack a working select.selected / option.selected
attribute. Ask isiahmeadows.
o("render select options", function() {
var select = {tag: "select", selectedIndex: 0, children: [
{tag:"option", attrs: {value: "1", selected: ""}}
]}
render(root, select)
})
*/
o("can be set as text", function() {
var a = makeSelect()
var b = makeSelect("2")