all files / directives/ html.js

100% Statements 12/12
66.67% Branches 4/6
100% Functions 3/3
100% Lines 12/12
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25        17×   17× 17× 17× 17× 17× 17× 17× 17×         20×        
import { avalon } from '../seed/core'
 
avalon.directive('html', {
 
    update: function(vdom, value) {
        this.beforeDispose()
 
        this.innerRender = avalon.scan('<div class="ms-html-container">' + value + '</div>', this.vm, function() {
            var oldRoot = this.root
            Eif(vdom.children)
               vdom.children.length = 0
            vdom.children = oldRoot.children
            this.root = vdom
            Eif (vdom.dom)
                avalon.clearHTML(vdom.dom)
        })
 
    },
    beforeDispose: function() {
        if (this.innerRender) {
            this.innerRender.dispose()
        }
    },
    delay: true
})