* Process a single text token. * * @param {Object} token * @param {Object} options * @return {Node}
(token, options)
| 7202 | */ |
| 7203 | |
| 7204 | function processTextToken(token, options) { |
| 7205 | var el; |
| 7206 | if (token.oneTime) { |
| 7207 | el = document.createTextNode(token.value); |
| 7208 | } else { |
| 7209 | if (token.html) { |
| 7210 | el = document.createComment('v-html'); |
| 7211 | setTokenType('html'); |
| 7212 | } else { |
| 7213 | // IE will clean up empty textNodes during |
| 7214 | // frag.cloneNode(true), so we have to give it |
| 7215 | // something here... |
| 7216 | el = document.createTextNode(' '); |
| 7217 | setTokenType('text'); |
| 7218 | } |
| 7219 | } |
| 7220 | function setTokenType(type) { |
| 7221 | if (token.descriptor) return; |
| 7222 | var parsed = parseDirective(token.value); |
| 7223 | token.descriptor = { |
| 7224 | name: type, |
| 7225 | def: directives[type], |
| 7226 | expression: parsed.expression, |
| 7227 | filters: parsed.filters |
| 7228 | }; |
| 7229 | } |
| 7230 | return el; |
| 7231 | } |
| 7232 | |
| 7233 | /** |
| 7234 | * Build a function that processes a textNode. |
no test coverage detected