Skip to content

Commit

Permalink
revert else-return
Browse files Browse the repository at this point in the history
  • Loading branch information
gkatsev committed May 1, 2015
1 parent 502f9cf commit 64cb362
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions src/js/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -910,25 +910,26 @@ class Component {
if (pxIndex !== -1) {
// Return the pixel value with no 'px'
return parseInt(val.slice(0, pxIndex), 10);
} else {
// No px so using % or no style was set, so falling back to offsetWidth/height
// If component has display:none, offset will return 0
// TODO: handle display:none and no dimension style using px
return parseInt(this.el_['offset' + Lib.capitalize(widthOrHeight)], 10);

// ComputedStyle version.
// Only difference is if the element is hidden it will return
// the percent value (e.g. '100%'')
// instead of zero like offsetWidth returns.
// var val = Lib.getComputedStyleValue(this.el_, widthOrHeight);
// var pxIndex = val.indexOf('px');

// if (pxIndex !== -1) {
// return val.slice(0, pxIndex);
// } else {
// return val;
// }
}

// No px so using % or no style was set, so falling back to offsetWidth/height
// If component has display:none, offset will return 0
// TODO: handle display:none and no dimension style using px
return parseInt(this.el_['offset' + Lib.capitalize(widthOrHeight)], 10);

// ComputedStyle version.
// Only difference is if the element is hidden it will return
// the percent value (e.g. '100%'')
// instead of zero like offsetWidth returns.
// var val = Lib.getComputedStyleValue(this.el_, widthOrHeight);
// var pxIndex = val.indexOf('px');

// if (pxIndex !== -1) {
// return val.slice(0, pxIndex);
// } else {
// return val;
// }
}

/**
Expand Down

0 comments on commit 64cb362

Please sign in to comment.