Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple args in binders - replace all occurrences of "*" #383

Merged
merged 1 commit into from
Oct 11, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/bindings.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ class Rivets.Binding
unless @binder = @view.binders[@type]
for identifier, value of @view.binders
if identifier isnt '*' and identifier.indexOf('*') isnt -1
regexp = new RegExp "^#{identifier.replace('*', '.+')}$"
regexp = new RegExp "^#{identifier.replace(/\*/g, '.+')}$"
if regexp.test @type
@binder = value
@args = new RegExp("^#{identifier.replace('*', '(.+)')}$").exec @type
@args = new RegExp("^#{identifier.replace(/\*/g, '(.+)')}$").exec @type
@args.shift()

@binder or= @view.binders['*']
Expand Down
2 changes: 1 addition & 1 deletion src/view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class Rivets.View
unless binder = @binders[type]
for identifier, value of @binders
if identifier isnt '*' and identifier.indexOf('*') isnt -1
regexp = new RegExp "^#{identifier.replace('*', '.+')}$"
regexp = new RegExp "^#{identifier.replace(/\*/g, '.+')}$"
if regexp.test type
binder = value

Expand Down