all files / vdom/ VText.js

100% Statements 9/9
100% Branches 2/2
100% Functions 3/3
100% Lines 9/9
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20    10× 10×           1104× 842× 262× 262×     76×    
import { avalon, document } from '../seed/core'
 
export function VText(text) {
    this.nodeName = '#text'
    this.nodeValue = text
}
 
VText.prototype = {
    constructor: VText,
    toDOM() {
        /* istanbul ignore if*/
        if (this.dom)
            return this.dom
        var v = avalon._decode(this.nodeValue)
        return this.dom = document.createTextNode(v)
    },
    toHTML() {
        return this.nodeValue
    }
}