Don't force the use of data attributes. Make the prefix an absolute prefix instead.
Showing
3 changed files
with
7 additions
and
6 deletions
... | @@ -67,7 +67,7 @@ Rivets.binders.if = | ... | @@ -67,7 +67,7 @@ Rivets.binders.if = |
67 | 67 | ||
68 | bind: (el) -> | 68 | bind: (el) -> |
69 | unless @marker? | 69 | unless @marker? |
70 | attr = ['data', @view.config.prefix, @type].join('-').replace '--', '-' | 70 | attr = [@view.config.prefix, @type].join('-').replace '--', '-' |
71 | declaration = el.getAttribute attr | 71 | declaration = el.getAttribute attr |
72 | 72 | ||
73 | @marker = document.createComment " rivets: #{@type} #{declaration} " | 73 | @marker = document.createComment " rivets: #{@type} #{declaration} " |
... | @@ -131,7 +131,7 @@ Rivets.binders['each-*'] = | ... | @@ -131,7 +131,7 @@ Rivets.binders['each-*'] = |
131 | 131 | ||
132 | bind: (el) -> | 132 | bind: (el) -> |
133 | unless @marker? | 133 | unless @marker? |
134 | attr = ['data', @view.config.prefix, @type].join('-').replace '--', '-' | 134 | attr = [@view.config.prefix, @type].join('-').replace '--', '-' |
135 | @marker = document.createComment " rivets: #{@type} " | 135 | @marker = document.createComment " rivets: #{@type} " |
136 | @iterated = [] | 136 | @iterated = [] |
137 | 137 | ... | ... |
... | @@ -19,7 +19,9 @@ Rivets = | ... | @@ -19,7 +19,9 @@ Rivets = |
19 | # The default configuration, publicly accessible on `module.config`. Can be | 19 | # The default configuration, publicly accessible on `module.config`. Can be |
20 | # overridden globally or local to a `Rivets.View` instance. | 20 | # overridden globally or local to a `Rivets.View` instance. |
21 | config: | 21 | config: |
22 | preloadData: true | 22 | prefix: 'rv' |
23 | rootInterface: '.' | 23 | rootInterface: '.' |
24 | preloadData: true | ||
25 | |||
24 | handler: (context, ev, binding) -> | 26 | handler: (context, ev, binding) -> |
25 | @call context, ev, binding.view.models | 27 | @call context, ev, binding.view.models | ... | ... |
... | @@ -18,12 +18,11 @@ class Rivets.View | ... | @@ -18,12 +18,11 @@ class Rivets.View |
18 | 18 | ||
19 | # Regular expression used to match binding attributes. | 19 | # Regular expression used to match binding attributes. |
20 | bindingRegExp: => | 20 | bindingRegExp: => |
21 | prefix = @config.prefix | 21 | new RegExp "^#{@config.prefix}-" |
22 | if prefix then new RegExp("^data-#{prefix}-") else /^data-/ | ||
23 | 22 | ||
24 | # Regular expression used to match component nodes. | 23 | # Regular expression used to match component nodes. |
25 | componentRegExp: => | 24 | componentRegExp: => |
26 | new RegExp "^#{@config.prefix?.toUpperCase() ? 'RV'}-" | 25 | new RegExp "^#{@config.prefix.toUpperCase()}-" |
27 | 26 | ||
28 | # Parses the DOM tree and builds `Rivets.Binding` instances for every matched | 27 | # Parses the DOM tree and builds `Rivets.Binding` instances for every matched |
29 | # binding declaration. | 28 | # binding declaration. | ... | ... |
-
Please register or sign in to post a comment