20f4b3c6 by Michael Richards

Don't force the use of data attributes. Make the prefix an absolute prefix instead.

1 parent 92b2cb08
......@@ -67,7 +67,7 @@ Rivets.binders.if =
bind: (el) ->
unless @marker?
attr = ['data', @view.config.prefix, @type].join('-').replace '--', '-'
attr = [@view.config.prefix, @type].join('-').replace '--', '-'
declaration = el.getAttribute attr
@marker = document.createComment " rivets: #{@type} #{declaration} "
......@@ -131,7 +131,7 @@ Rivets.binders['each-*'] =
bind: (el) ->
unless @marker?
attr = ['data', @view.config.prefix, @type].join('-').replace '--', '-'
attr = [@view.config.prefix, @type].join('-').replace '--', '-'
@marker = document.createComment " rivets: #{@type} "
@iterated = []
......
......@@ -19,7 +19,9 @@ Rivets =
# The default configuration, publicly accessible on `module.config`. Can be
# overridden globally or local to a `Rivets.View` instance.
config:
preloadData: true
prefix: 'rv'
rootInterface: '.'
preloadData: true
handler: (context, ev, binding) ->
@call context, ev, binding.view.models
......
......@@ -18,12 +18,11 @@ class Rivets.View
# Regular expression used to match binding attributes.
bindingRegExp: =>
prefix = @config.prefix
if prefix then new RegExp("^data-#{prefix}-") else /^data-/
new RegExp "^#{@config.prefix}-"
# Regular expression used to match component nodes.
componentRegExp: =>
new RegExp "^#{@config.prefix?.toUpperCase() ? 'RV'}-"
new RegExp "^#{@config.prefix.toUpperCase()}-"
# Parses the DOM tree and builds `Rivets.Binding` instances for every matched
# binding declaration.
......