Closed miohtama closed 12 years ago
Thanks for the feedback. I totally understand the need, based on the IRC discussion.
I think about the API over night, request for comments tomorrow and go for the implementation on Sunday.
Here's the API proposal.
I ended up proposing that the matcher can be given just for one call or for all the calls. The latter is probably the more common scenario.
# Match only by data-bind. Return true, if the element matches to the key.
matcher = (element, key) ->
element.getAttribute('data-bind') == key
# Use the custom matcher only for this call
$('#template').render data, {}, matcher: matcher
# Use the custom matcher for all the calls in the future
Transparency.config.matcher = matcher
# Matches only by data-bind
$('#template').render data
So that people can use any black magic they wish to bind templates.
Useful e.g. in projects where several people are working on the same HTML code.