From deeb73973ff842eea28472f94be97ca7d8d08b1e Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Tue, 6 May 2014 22:26:30 -0400 Subject: [PATCH] fix datalist and link redraw --- docs/change-log.md | 10 ++++++++++ mithril.js | 6 ++++-- tests/input-cursor.html | 7 ++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/docs/change-log.md b/docs/change-log.md index 088afcc7..9c78f217 100644 --- a/docs/change-log.md +++ b/docs/change-log.md @@ -1,5 +1,15 @@ ## Change Log +[v0.1.12](/mithril/archive/v0.1.12) - maintenance + +### Bug Fixes: + +- Fix link location in links using `config: m.route` after redraws [#74](https://github.com/lhorie/mithril.js/issues/74) +- Fixed support for `list` attribute in inputs [#69](https://github.com/lhorie/mithril.js/issues/69) + +--- + + [v0.1.11](/mithril/archive/v0.1.11) - maintenance ### News: diff --git a/mithril.js b/mithril.js index 48525581..bce0eaaa 100644 --- a/mithril.js +++ b/mithril.js @@ -150,7 +150,7 @@ Mithril = m = new function app(window) { else if (attrName === "value" && tag === "input") { if (node.value !== dataAttr) node.value = dataAttr } - else if (attrName in node) node[attrName] = dataAttr + else if (attrName in node && attrName != "list") node[attrName] = dataAttr else node.setAttribute(attrName, dataAttr) } } @@ -279,7 +279,9 @@ Mithril = m = new function app(window) { else if (arguments[0].addEventListener) { var element = arguments[0] var isInitialized = arguments[1] - element.href = location.pathname + modes[m.route.mode] + element.pathname + if (element.href.indexOf(modes[m.route.mode]) < 0) { + element.href = location.pathname + modes[m.route.mode] + element.pathname + } if (!isInitialized) { element.removeEventListener("click", routeUnobtrusive) element.addEventListener("click", routeUnobtrusive) diff --git a/tests/input-cursor.html b/tests/input-cursor.html index 75aa76a5..8611e06e 100644 --- a/tests/input-cursor.html +++ b/tests/input-cursor.html @@ -13,10 +13,15 @@ app.controller = function() { app.view = function(ctrl) { return m("body", [ m("h1", ["Title: ", ctrl.title()]), - m("input", { + m("input[list=data]", { onkeyup: m.withAttr("value", ctrl.title), value: ctrl.title() }), + m("datalist#data", [ + m("option", "John"), + m("option", "Bob"), + m("option", "Mary") + ]), m("br"), m("textarea", { onkeyup: m.withAttr("value", ctrl.title),