Skip to content

Commit

Permalink
fix: RestoreScroll was running out of sync (#508)
Browse files Browse the repository at this point in the history
  • Loading branch information
WilcoFiers authored Sep 6, 2017
1 parent 4074132 commit ff3df2d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/core/public/run-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ function runRules(context, options, resolve, reject) {
axe.utils.collectResultsFromFrames(context, options, 'rules', null, res, rej);
});
}
let scrollState;
q.defer(function (res, rej) {
if (options.restoreScroll) {
const scrollState = axe.utils.getScrollState();
audit.run(context, options, res, rej);
axe.utils.setScrollState(scrollState);

} else {
audit.run(context, options, res, rej);
scrollState = axe.utils.getScrollState();
}
audit.run(context, options, res, rej);
});
q.then(function (data) {
try {
if (scrollState) {
axe.utils.setScrollState(scrollState);
}
if (options.performanceTimer) {
axe.utils.performanceTimer.auditEnd();
}
Expand Down

0 comments on commit ff3df2d

Please sign in to comment.