Sha256: 34d37a85f2ded4d40762a617e89806d2c01e891a185cde4a5740104bc28f6cd3

Contents?: true

Size: 1.29 KB

Versions: 14

Compression:

Stored size: 1.29 KB

Contents

var utils = require('../utils')

/**
 *  Binding for partials
 */
module.exports = {

    isLiteral: true,

    bind: function () {

        var id = this.expression
        if (!id) return

        var el       = this.el,
            compiler = this.compiler,
            partial  = compiler.getOption('partials', id)

        if (!partial) {
            if (id === 'yield') {
                utils.warn('{{>yield}} syntax has been deprecated. Use <content> tag instead.')
            }
            return
        }

        partial = partial.cloneNode(true)

        // comment ref node means inline partial
        if (el.nodeType === 8) {

            // keep a ref for the partial's content nodes
            var nodes = [].slice.call(partial.childNodes),
                parent = el.parentNode
            parent.insertBefore(partial, el)
            parent.removeChild(el)
            // compile partial after appending, because its children's parentNode
            // will change from the fragment to the correct parentNode.
            // This could affect directives that need access to its element's parentNode.
            nodes.forEach(compiler.compile, compiler)

        } else {

            // just set innerHTML...
            el.innerHTML = ''
            el.appendChild(partial)

        }
    }

}

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
fluentd-ui-0.3.8 vendor/assets/javascripts/bower/vue/src/directives/partial.js
fluentd-ui-0.3.7 vendor/assets/javascripts/bower/vue/src/directives/partial.js
fluentd-ui-0.3.6 vendor/assets/javascripts/bower/vue/src/directives/partial.js
fluentd-ui-0.3.5 vendor/assets/javascripts/bower/vue/src/directives/partial.js
fluentd-ui-0.3.3 vendor/assets/javascripts/bower/vue/src/directives/partial.js
fluentd-ui-0.3.2 vendor/assets/javascripts/bower/vue/src/directives/partial.js
fluentd-ui-0.3.1 vendor/assets/javascripts/bower/vue/src/directives/partial.js
fluentd-ui-0.3.0 vendor/assets/javascripts/bower/vue/src/directives/partial.js
fluentd-ui-0.2.0 vendor/assets/javascripts/bower/vue/src/directives/partial.js
fluentd-ui-0.1.4 vendor/assets/javascripts/bower/vue/src/directives/partial.js
fluentd-ui-0.1.3 vendor/assets/javascripts/bower/vue/src/directives/partial.js
fluentd-ui-0.1.2 vendor/assets/javascripts/bower/vue/src/directives/partial.js
fluentd-ui-0.1.1 vendor/assets/javascripts/bower/vue/src/directives/partial.js
fluentd-ui-0.1.0 vendor/assets/javascripts/bower/vue/src/directives/partial.js