Implement Component#visible.

This commit is contained in:
Jürg Lehni 2014-09-30 08:16:26 +02:00
parent c7970e367d
commit 021ba59c54
2 changed files with 13 additions and 0 deletions

View file

@ -149,6 +149,11 @@ var DomElement = new function() {
new RegExp('\\s*' + cls + '\\s*'), ' ').trim();
},
toggleClass: function(el, cls, state) {
this[state === undefined ? !this.hasClass(el, cls) : state
? 'addClass' : 'removeClass'](el, cls);
},
remove: function(el) {
if (el.parentNode)
el.parentNode.removeChild(el);

View file

@ -198,6 +198,14 @@ var Component = Base.extend(Callback, /** @lends Component# */{
}
},
getVisible: function() {
return !DomElement.hasClass(this._element, 'hidden');
},
setVisible: function(visible) {
DomElement.toggleClass(this._element, 'hidden', !visible);
},
getRange: function() {
return [parseFloat(DomElement.get(this._input, 'min')),
parseFloat(DomElement.get(this._input, 'max'))];