* Build a function that processes a textNode. * * @param {Array } tokens * @param {DocumentFragment} frag
(tokens, frag)
| 7238 | */ |
| 7239 | |
| 7240 | function makeTextNodeLinkFn(tokens, frag) { |
| 7241 | return function textNodeLinkFn(vm, el, host, scope) { |
| 7242 | var fragClone = frag.cloneNode(true); |
| 7243 | var childNodes = toArray(fragClone.childNodes); |
| 7244 | var token, value, node; |
| 7245 | for (var i = 0, l = tokens.length; i < l; i++) { |
| 7246 | token = tokens[i]; |
| 7247 | value = token.value; |
| 7248 | if (token.tag) { |
| 7249 | node = childNodes[i]; |
| 7250 | if (token.oneTime) { |
| 7251 | value = (scope || vm).$eval(value); |
| 7252 | if (token.html) { |
| 7253 | replace(node, parseTemplate(value, true)); |
| 7254 | } else { |
| 7255 | node.data = _toString(value); |
| 7256 | } |
| 7257 | } else { |
| 7258 | vm._bindDir(token.descriptor, node, host, scope); |
| 7259 | } |
| 7260 | } |
| 7261 | } |
| 7262 | replace(el, fragClone); |
| 7263 | }; |
| 7264 | } |
| 7265 | |
| 7266 | /** |
| 7267 | * Compile a node list and return a childLinkFn. |
no test coverage detected