Last active
December 26, 2015 18:49
-
-
Save devmanhinton/7197605 to your computer and use it in GitHub Desktop.
Alternative to Current Collection Recognition
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
Hey! | |
Currently, a collection is recognized by the rules.js "collection" rule-- The el has a child that is the singular version | |
of itself. | |
This adds a cognitive load because it adds a conidtional to another rule:the model/scoping rule. | |
The model/scoping rule without collections: 'A dom elem with a class that ends in a dash will bind the children | |
of that dom element to the child of that name of the current model in scope' | |
The model/scoping rule with collections: the above rule + " unless that dom element has a child with a singular version | |
of this dom elements class name.' | |
Example: | |
<div class='users-'> | |
<div class='user-"> <--- This 'user-' is essentially ignored once a collection rule is matched. | |
</div> | |
</div> | |
Lets change endDash to have a new keyword 'iteration'. Then: | |
<div class="bind_users-"> | |
<div> | |
//Actions | |
</div> | |
</div> | |
Or keyword 'collection' | |
<div class='show_users-"> | |
<div> | |
//Actions | |
</div> | |
</div> | |
Main downside: | |
The div inside (empty without the className) is necessary but is a bit ugly. Could be probably not require it | |
but it would make the change a bit trickier | |
I'm open to other keywords as well*. | |
*This also could be a great opportunity to add a fun 'endDash' name. Introduce a fun name for collections used in endDash. | |
And then do 'ourAwesomeName_users'. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment