Permalink
Browse files

Ensuring that class values used in TabSwapper are not empty.

  • Loading branch information...
1 parent cd4caee commit 2d0a4d962ade0a626638e88077a7780771d2ac61 @anutron committed Nov 20, 2013
Showing with 6 additions and 2 deletions.
  1. +6 −2 Source/Layout/TabSwapper.js
@@ -40,6 +40,8 @@ var TabSwapper = new Class({
sectionFx: [],
initialize: function(options){
this.setOptions(options);
+ if (this.options.selectedClass) this.options.selectedClass = this.options.selectedClass.trim();
+ if (this.options.deselectedClass) this.options.deselectedClass = this.options.deselectedClass.trim();
var prev = this.setup();
if (prev) return prev;
if (this.options.initPanel != null) this.show(this.options.initPanel);
@@ -148,7 +150,8 @@ var TabSwapper = new Class({
if (sect.getStyle('display') != 'none') {
this.lastHeight = sect.getSize().y;
sect.setStyle('display', 'none');
- tab.swapClass(this.options.selectedClass, this.options.deselectedClass);
+ if (this.options.selectedClass) tab.removeClass(this.options.selectedClass);
+ if (this.options.deselectedClass) tab.addClass(this.options.deselectedClass);
this.fireEvent('onBackground', [idx, sect, tab]);
}
return this;
@@ -201,7 +204,8 @@ var TabSwapper = new Class({
this.now = idx;
this.fireEvent('onActive', [idx, sect, tab]);
}
- tab.swapClass(this.options.deselectedClass, this.options.selectedClass);
+ if (this.options.selectedClass) tab.addClass(this.options.selectedClass);
+ if (this.options.deselectedClass) tab.removeClass(this.options.deselectedClass);
return this;
}
});

0 comments on commit 2d0a4d9

Please sign in to comment.