aurelia / aurelia/animator-css

Add toggleClass() to the animation abstraction

Open
#59 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
44
Forks
25
PR merge metrics
No merged PRs in 30d

Description

**I'm submitting a feature request**

* **Library Version:**
1.0.1

**Please tell us about your environment:**
* **Operating System:**
OSX 10.x

* **Node Version:**
7.3.0

* **NPM Version:**
3.10.10

* **JSPM OR Webpack AND Version**
JSPM 0.16.53

* **Browser:**
all

* **Language:**
ESNext

**Current behavior:**
Presently, the animation abstraction offers up `addClass()` and `removeClass()`. This leads to code like this:

```
if (reveal) {
this.animator.addClass(...);
else {
this.animator.removeClass(...);
}
```
Not the end of the world, but a little verbose.

**Expected/desired behavior:**
I would suggest a `toggleClass()` method on the abstraction. It is certainly in keeping with many of the animation libraries out there, including jQuery's, and it would allow the above to be reduced to:

```
this.animator.toggleClass(...);
```

* **What is the motivation / use case for changing the behavior?**
Terseness, clarity, and harmony with many animation libraries' conventional approach.

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Start by locating the animation abstraction and its existing addClass() and removeClass() implementations, then inspect how callers use them. Done means the abstraction exposes toggleClass() consistently and the relevant behavior is covered by the project's existing tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.