Restyle a ternary

old
Javi Velasco 2016-06-25 12:26:20 +02:00
parent 5b97b95c62
commit 8d65961be2
1 changed files with 4 additions and 6 deletions

View File

@ -81,12 +81,10 @@ const factory = (FontIcon) => {
const element = this.refs.input;
// compute the height difference between inner height and outer height
const style = getComputedStyle(element, null);
let heightOffset = 0;
if (style.boxSizing === 'content-box') {
heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
} else {
heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
}
const heightOffset = style.boxSizing === 'content-box'
? -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom))
: parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
// resize the input to its content size
element.style.height = 'auto';
element.style.height = `${element.scrollHeight + heightOffset}px`;