Fix textNode binding issue (was using appendChild instead of inserting in place). [#210]
Showing
1 changed file
with
3 additions
and
10 deletions
... | @@ -54,20 +54,13 @@ class Rivets.View | ... | @@ -54,20 +54,13 @@ class Rivets.View |
54 | if delimiters = @config.templateDelimiters | 54 | if delimiters = @config.templateDelimiters |
55 | if (tokens = parser.parse(node.data, delimiters)).length | 55 | if (tokens = parser.parse(node.data, delimiters)).length |
56 | unless tokens.length is 1 and tokens[0].type is parser.types.text | 56 | unless tokens.length is 1 and tokens[0].type is parser.types.text |
57 | [startToken, restTokens...] = tokens | 57 | for token in tokens |
58 | node.data = startToken.value | ||
59 | |||
60 | if startToken.type is 0 | ||
61 | node.data = startToken.value | ||
62 | else | ||
63 | buildBinding 'TextBinding', node, null, startToken.value | ||
64 | |||
65 | for token in restTokens | ||
66 | text = document.createTextNode token.value | 58 | text = document.createTextNode token.value |
67 | node.parentNode.appendChild text | 59 | node.parentNode.insertBefore text, node |
68 | 60 | ||
69 | if token.type is 1 | 61 | if token.type is 1 |
70 | buildBinding 'TextBinding', text, null, token.value | 62 | buildBinding 'TextBinding', text, null, token.value |
63 | node.parentNode.removeChild node | ||
71 | else if componentRegExp.test node.tagName | 64 | else if componentRegExp.test node.tagName |
72 | type = node.tagName.replace(componentRegExp, '').toLowerCase() | 65 | type = node.tagName.replace(componentRegExp, '').toLowerCase() |
73 | @bindings.push new Rivets.ComponentBinding @, node, type | 66 | @bindings.push new Rivets.ComponentBinding @, node, type | ... | ... |
-
Please register or sign in to post a comment