cd122b24 by Michael Richards

Allow disabling template parsing by setting Rivets.config.templateDelimiters to …

…false, undefined or null. [#181]
1 parent a4800c6e
...@@ -213,20 +213,20 @@ class Rivets.View ...@@ -213,20 +213,20 @@ class Rivets.View
213 unless node in skipNodes 213 unless node in skipNodes
214 if node.nodeType is Node.TEXT_NODE 214 if node.nodeType is Node.TEXT_NODE
215 parser = Rivets.TextTemplateParser 215 parser = Rivets.TextTemplateParser
216 delimiters = @config.templateDelimiters
217 216
218 if (tokens = parser.parse(node.data, delimiters)).length 217 if delimiters = @config.templateDelimiters
219 unless tokens.length is 1 and tokens[0].type is parser.types.text 218 if (tokens = parser.parse(node.data, delimiters)).length
220 [startToken, restTokens...] = tokens 219 unless tokens.length is 1 and tokens[0].type is parser.types.text
221 node.data = startToken.value 220 [startToken, restTokens...] = tokens
221 node.data = startToken.value
222 222
223 switch startToken.type 223 switch startToken.type
224 when 0 then node.data = startToken.value 224 when 0 then node.data = startToken.value
225 when 1 then buildBinding node, 'textNode', startToken.value 225 when 1 then buildBinding node, 'textNode', startToken.value
226 226
227 for token in restTokens 227 for token in restTokens
228 node.parentNode.appendChild (text = document.createTextNode token.value) 228 node.parentNode.appendChild (text = document.createTextNode token.value)
229 buildBinding text, 'textNode', token.value if token.type is 1 229 buildBinding text, 'textNode', token.value if token.type is 1
230 230
231 else if node.attributes? 231 else if node.attributes?
232 for attribute in node.attributes 232 for attribute in node.attributes
......