Stop relying on group split matching to keep separators
"string.path".split(/\./) should return: ["string", ".", "path"] This is not the case in IE8. IE returns: ["string", "path"] Instead do the split discarding the separators, get model and keypath from this array. Check unsplit path to se if the string has a bypass separator to set the option flag. This should probably be tested.
Showing
1 changed file
with
7 additions
and
6 deletions
... | @@ -72,7 +72,7 @@ class Rivets.Binding | ... | @@ -72,7 +72,7 @@ class Rivets.Binding |
72 | @model[@keypath] | 72 | @model[@keypath] |
73 | else | 73 | else |
74 | Rivets.config.adapter.read @model, @keypath | 74 | Rivets.config.adapter.read @model, @keypath |
75 | 75 | ||
76 | Rivets.config.adapter.subscribe @model, keypath, callback | 76 | Rivets.config.adapter.subscribe @model, keypath, callback |
77 | 77 | ||
78 | if @type in @bidirectionals | 78 | if @type in @bidirectionals |
... | @@ -122,11 +122,12 @@ class Rivets.View | ... | @@ -122,11 +122,12 @@ class Rivets.View |
122 | type = attribute.name.replace bindingRegExp, '' | 122 | type = attribute.name.replace bindingRegExp, '' |
123 | pipes = (pipe.trim() for pipe in attribute.value.split '|') | 123 | pipes = (pipe.trim() for pipe in attribute.value.split '|') |
124 | context = (ctx.trim() for ctx in pipes.shift().split '>') | 124 | context = (ctx.trim() for ctx in pipes.shift().split '>') |
125 | path = context.shift().split /(\.|:)/ | 125 | path = context.shift() |
126 | splitPath = path.split /\.|:/ | ||
126 | options.formatters = pipes | 127 | options.formatters = pipes |
127 | model = @models[path.shift()] | 128 | model = @models[splitPath.shift()] |
128 | options.bypass = path.shift() is ':' | 129 | options.bypass = path.indexOf(":") != -1 |
129 | keypath = path.join() | 130 | keypath = splitPath.join() |
130 | 131 | ||
131 | if dependencies = context.shift() | 132 | if dependencies = context.shift() |
132 | options.dependencies = dependencies.split /\s+/ | 133 | options.dependencies = dependencies.split /\s+/ |
... | @@ -244,4 +245,4 @@ rivets = | ... | @@ -244,4 +245,4 @@ rivets = |
244 | if module? | 245 | if module? |
245 | module.exports = rivets | 246 | module.exports = rivets |
246 | else | 247 | else |
247 | @rivets = rivets | 248 | @rivets = rivets |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment