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

Check enterToClass/leaveToClass existence before adding it #5912

Merged
merged 3 commits into from
Jun 30, 2017

Conversation

jkzing
Copy link
Member

@jkzing jkzing commented Jun 18, 2017

Related to #5800

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

@jkzing
Copy link
Member Author

jkzing commented Jun 18, 2017

When leave a tab in Chrome, timer (setInterval) seems not be throttled but requestAnimationFrame is. So that will result in vue keeping enqueue requestAnimationFrame tasks, and all of them will be executed when user comes back to the tab. (That's why I'm using _transitionClasses to do the checking rather than el.classList)

@@ -68,6 +68,10 @@ export function nextFrame (fn: Function) {
})
}

export function hasTransitionClass (el: any, cls: string) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to just check this directly inside addTransitionClass.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put hasTransitionClass check only inside nextFrame is trying to avoid unnecessary checking. It fair to put it inside addTransitionClass.

@yyx990803 yyx990803 merged commit 34d8c79 into vuejs:dev Jun 30, 2017
@jkzing jkzing deleted the dup-trans-cls branch June 30, 2017 07:00
@jkzing
Copy link
Member Author

jkzing commented Jun 30, 2017

thanks👍

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

Successfully merging this pull request may close these issues.

2 participants