mirror of https://github.com/vuejs/vue.git
use `nodeValue` instead of `textContent` for textNodes
This commit is contained in:
parent
1d2c32d000
commit
f98eb96817
|
|
@ -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) {
|
||||||
|
|
|
||||||
|
|
@ -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')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue