Permalink
Browse files

Merge pull request #2410 from gonchuki/small_element_style_optimization

get rid of useless for..in loop in getStyle
  • Loading branch information...
2 parents 1f73ef0 + cb327bf commit d2a662dac2bfee20df560f97fad7f210b63cb8d2 @ibolmo ibolmo committed Aug 20, 2012
Showing with 3 additions and 4 deletions.
  1. +3 −4 Source/Element/Element.Style.js
@@ -114,10 +114,9 @@ Element.implement({
property = (property == 'float' ? floatName : property).camelCase();
var result = this.style[property];
if (!result || property == 'zIndex'){
- result = [];
- for (var style in Element.ShortStyles){
- if (property != style) continue;
- for (var s in Element.ShortStyles[style]) result.push(this.getStyle(s));
+ if (Element.ShortStyles.hasOwnProperty(property)){
+ result = [];
+ for (var s in Element.ShortStyles[property]) result.push(this.getStyle(s));
return result.join(' ');
}
result = this.getComputedStyle(property);

0 comments on commit d2a662d

Please sign in to comment.