Skip to content

Commit

Permalink
Minimizing place class juggling
Browse files Browse the repository at this point in the history
  • Loading branch information
darsain committed Dec 18, 2013
1 parent 56ffd9d commit 57092f3
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,16 @@ Tooltip.prototype.position = function (x, y) {
height: 0
} : position(x);
var spacing = this.spacing;
var newPlace = this._pickPlace(target);

// Pick the place and adjust className accordingly
if (this.curPlace) {
this.classes.remove(this.curPlace);
// Add/Change place class when necessary
if (newPlace !== this.curPlace) {
if (this.curPlace) {
this.classes.remove(this.curPlace);
}
this.classes.add(newPlace);
this.curPlace = newPlace;
}
this.curPlace = this._pickPlace(target);
this.classes.add(this.curPlace);

// Position the tip
var top, left;
Expand Down

0 comments on commit 57092f3

Please sign in to comment.