From 657c52b9475fa4e86c492148e3ceddb47503ab00 Mon Sep 17 00:00:00 2001 From: redaktor Date: Sat, 29 Mar 2014 09:41:30 +0100 Subject: [PATCH] added support for textNode [Sebastian Lasse proposed] dbind should support "plain text nodes"... --- bind.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bind.js b/bind.js index 266807b..95726c8 100644 --- a/bind.js +++ b/bind.js @@ -119,7 +119,8 @@ define([], function(){ for(var i in this.value){ if(i.charAt(0) != '_'){ callback(i, this.get(i)); - } } + } + } }, to: function(source, property){ // Connect this binding to another binding, such that any changes in the source @@ -239,6 +240,8 @@ define([], function(){ }else{ element.value = value || ""; } + }else if(element.nodeType == 3){ + element.nodeValue = value || ""; }else{ element.innerText = value || ""; } @@ -301,6 +304,8 @@ define([], function(){ element.onchange = function(){ callback(element.value); }; + }else if(element.nodeType == 3){ + callback(element.nodeValue); }else{ callback(element.innerText); }