use `nodeValue` instead of `textContent` for textNodes

This commit is contained in:
Evan You 2014-03-03 12:25:27 -05:00
parent 1d2c32d000
commit f98eb96817
2 changed files with 10 additions and 2 deletions

View File

@ -20,8 +20,15 @@ module.exports = {
} }
}, },
text: function (value) { text: {
this.el.textContent = utils.toText(value) bind: function () {
this.attr = this.el.nodeType === 3
? 'nodeValue'
: 'textContent'
},
update: function (value) {
this.el[this.attr] = utils.toText(value)
}
}, },
show: function (value) { show: function (value) {

View File

@ -48,6 +48,7 @@ describe('UNIT: Directives', function () {
describe('text', function () { describe('text', function () {
var dir = mockDirective('text') var dir = mockDirective('text')
dir.bind()
it('should work with a string', function () { it('should work with a string', function () {
dir.update('hallo') dir.update('hallo')