From d797ba7bfda64d9283a2b9368aa7ae61739c7661 Mon Sep 17 00:00:00 2001 From: 0x8890 <0x8890@airmail.cc> Date: Mon, 30 May 2016 14:10:04 +0200 Subject: [PATCH] fix checkbox default function --- lib/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index cda9232..225e7cc 100644 --- a/lib/index.js +++ b/lib/index.js @@ -110,7 +110,10 @@ function bindObject (obj, def) { // Default DOM mutation functions. function replaceText (node, value) { node.textContent = value } function replaceValue (node, value) { node.value = value } -function replaceChecked (context) { node.checked = context.value } +function replaceChecked (node, value) { + if (value) node.checked = 'checked' + else node.removeAttribute('checked') +} // Private static property, used for checking parent binding function. Object.defineProperty(replaceText, '__isDefault', { value: true })