Created
October 10, 2013 18:21
-
-
Save brian-mann/6923050 to your computer and use it in GitHub Desktop.
Clever trick to automate children tagName based on their parent's element
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Views.CompositeView extends Marionette.CompositeView | |
| itemViewEventPrefix: "childview" | |
| itemViewOptions: (model, index) -> | |
| options = {} | |
| options.tagName = "tr" if @itemViewContainer is "tbody" | |
| options | |
| class Views.CollectionView extends Marionette.CollectionView | |
| itemViewEventPrefix: "childview" | |
| itemViewOptions: (model, index) -> | |
| options = {} | |
| options.tagName = "li" if @tagName is "ul" | |
| options |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment