Closed miohtama closed 12 years ago
How about just
directives =
person: (elem, i) ->
elem = jQuery elem
elem.attr "foobar", "foo"
elem.text "daa"
{}
I didn't test it, but as far as I see, it should work with current implementation?
Of course, the pull request would make things easier with javascript, as one could omit the last line.
Thinking outside CoffeeScript box:
... so this is much more useful in JS side of the things and users do not return magical {}.
It is mostly what "users would think how API behaves" and thus will save lots of people from gotcha.
Fair enough, I'll merge to master :)
Before that, a bit of cleanup is needed. The pull request contains implementation also for the object-like directives, which is a separate topic.
Looks like Github pull requests somehow picksk up the latest commits even if they are not on available on the moment I made the pull requests. Github > me :(
Probably the correct use is to make only one pull request per branch?
Yes, that's correct. Easiest way is to make a pull request is from a dedicated feature branch (which is kept up-to-date with upstream/master).
Used git create branch from commit and then re-created pull request to get correct commit range:
http://stackoverflow.com/questions/2816715/branch-from-a-previous-commit-using-git
Apparently Github pulls always the whole branch in the request and you cannot set commit range (even though it says commit range in the Github user interface). Please see the new pull request, closing this one.
Add support for cases where directive handler uses jQuery to directly manipulate DOM in-place, instead of returning text or HTML snippet.
In complex manipulation cases this may be
The change itself is that if directive function returns null then don't try to run text or html replacement on this null value.