js/foundation/view/view.js in rsence-2.1.7 vs js/foundation/view/view.js in rsence-2.1.8

- old
+ new

@@ -1045,10 +1045,24 @@ } return this; }, setStyles: function(_styles){ + var _stylesObjType = COMM.Values.type(_styles); + if(_stylesObjType==='a'){ + this.setStylesArray(_styles); + } + else if(_stylesObjType==='h'){ + this.setStylesHash(_styles); + } + else { + console.log('HView#setStyles: Invalid data, expected array or hash; type: '+h+', data:',_styles); + } + return this; + }, + + setStylesArray: function(_styles){ var _styleItem, _styleKey, _styleValue, i = 0; for(;i<_styles.length;i++){ _styleItem = _styles[i]; _styleKey = _styleItem[0]; @@ -1056,10 +1070,20 @@ this.setStyle(_styleKey,_styleValue); } return this; }, + setStylesHash: function(_styles){ + var + _styleKey, _styleValue; + for(_styleKey in _styles){ + _styleValue = _styles[_styleKey]; + this.setStyle(_styleKey,_styleValue); + } + return this; + }, + /** = Description * Returns a style of the main DOM element of the component. * Utilizes +ELEM+ cache to perform the action. * * = Parameters @@ -1250,10 +1274,13 @@ this.hide(); this.drawn = false; this.stopAnimation(); // Delete the children first. var _childViewId, i; + if(!this.views){ + console.log('HView#die: no subviews for component name: ',this.componentName,', self:',this); + } while (this.views.length !== 0) { _childViewId = this.views[0]; this.destroyView(_childViewId); } // Remove this object's bindings, except the DOM element. @@ -1363,13 +1390,10 @@ **/ bounds: function() { // Could be cached. var _bounds = new HRect(this.rect); - _bounds.right -= _bounds.left; - _bounds.left = 0; - _bounds.bottom -= _bounds.top; - _bounds.top = 0; + _bounds.offsetTo(0,0); return _bounds; },