Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve interaction interpreter classes affordances #134

Closed
gcotelli opened this issue Oct 5, 2018 · 0 comments · Fixed by #182
Closed

Improve interaction interpreter classes affordances #134

gcotelli opened this issue Oct 5, 2018 · 0 comments · Fixed by #182
Assignees
Milestone

Comments

@gcotelli
Copy link
Member

gcotelli commented Oct 5, 2018

Right now we have a lot of methods with several tiny variations involving what to do with the class and how to match the component. Look for implementors of:

  • addCssClass:*
  • changeCssClass:to:*
  • removeCssClass:*
  • toggleCssClass:*

I think we can have only two methods in the interpreter:

  • updateClassList:
  • updateClassList:onElementsMatching:

The first one will apply the changes on the DOM element starting the interaction, the second one allows to use some logic to match the element.

So we can have something like:

[:classList | classList addClass bootstrap button ]
[:classList | classList addClass: 'xxx']
[:classList | classList removeClass bootstrap button]
[:classList | classList removeClass: 'xxx']
[:classList | classList toggle bootstrap button]
[:classList | classList toggle: 'xxx']
[:classList | classList replace: 'xxx' with: 'zzz']

for the first argument and

[:document | document getElementsByClassName bootstrap button ]
[:document | document getElementsByClassName: 'pepe' ]
[:document | document getElementsBySelector: [:selector | selector form class: #bootstrap ]]
[:document | document getElementById: #aaa ]
[:document | document jQuery blaballa ]

for the querying capabilities

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants