43 lines
1.1 KiB
HTML
43 lines
1.1 KiB
HTML
<p>Typing in the fields below should not move the cursor to the end of the input. Especially in Chrome</p>
|
|
<p>All inputs should update with the same value</p>
|
|
<p>Typing in an input should not prevent it from being updated by other inputs</p>
|
|
<div id="test"></div>
|
|
<script src="../mithril.js"></script>
|
|
<script>
|
|
var app = {}
|
|
|
|
app.controller = function() {
|
|
this.title = m.prop("hello world");
|
|
}
|
|
|
|
app.view = function(ctrl) {
|
|
return m("body", [
|
|
m("h1", ["Title: ", ctrl.title()]),
|
|
m("input", {
|
|
onkeyup: m.withAttr("value", ctrl.title),
|
|
value: ctrl.title()
|
|
}),
|
|
m("br"),
|
|
m("textarea", {
|
|
onkeyup: m.withAttr("value", ctrl.title),
|
|
value: ctrl.title()
|
|
}),
|
|
m("br"),
|
|
m("textarea", {
|
|
onkeyup: m.withAttr("value", ctrl.title)
|
|
}, ctrl.title()),
|
|
m("br"),
|
|
m("div[contenteditable]", {
|
|
style: {border: "1px solid #888"},
|
|
onkeyup: m.withAttr("innerHTML", ctrl.title)
|
|
}, ctrl.title()),
|
|
m("br"),
|
|
m("div[contenteditable]", {
|
|
style: {border: "1px solid #888"},
|
|
onkeyup: m.withAttr("innerHTML", ctrl.title)
|
|
}, m.trust(ctrl.title())),
|
|
]);
|
|
}
|
|
|
|
m.module(document.getElementById("test"), app);
|
|
</script>
|