Skip to content

Commit

Permalink
Viewport Height component no longer forces box-sizing: border-box
Browse files Browse the repository at this point in the history
  • Loading branch information
janschoenherr committed Sep 25, 2018
1 parent b948afd commit 297cf54
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -9,6 +9,7 @@
### Changed

- Viewport Height component no longer sets a `height` except for IE
- Viewport Height component no longer forces `box-sizing: border-box`
- Improve Tooltip performance
- Improve Parallax performance

Expand Down
11 changes: 4 additions & 7 deletions src/js/core/height-viewport.js
@@ -1,5 +1,5 @@
import FlexBug from '../mixin/flex-bug';
import {css, endsWith, height, isNumeric, isString, offset, query, toFloat} from 'uikit-util';
import {boxModelAdjust, css, endsWith, height, isNumeric, isString, offset, query, toFloat} from 'uikit-util';

export default {

Expand All @@ -19,19 +19,16 @@ export default {
minHeight: 0
},

connected() {
css(this.$el, 'boxSizing', 'border-box');
},

update: {

read() {

let minHeight = '';
const box = boxModelAdjust('height', this.$el, 'content-box');

if (this.expand) {

minHeight = height(window) - (offsetHeight(document.documentElement) - offsetHeight(this.$el)) || '';
minHeight = height(window) - (offsetHeight(document.documentElement) - offsetHeight(this.$el)) - box || '';

} else {

Expand Down Expand Up @@ -63,7 +60,7 @@ export default {

}

minHeight += ')';
minHeight += `${box ? ` - ${box}px` : ''})`;

}

Expand Down
4 changes: 2 additions & 2 deletions src/js/mixin/flex-bug.js
@@ -1,4 +1,4 @@
import {$$, css, isIE, toFloat} from 'uikit-util';
import {$$, css, height as getHeight, isIE, toFloat} from 'uikit-util';

// IE 11 fix (min-height on a flex container won't apply to its flex items)
export default isIE ? {
Expand Down Expand Up @@ -35,7 +35,7 @@ export default isIE ? {
write() {
this.elements.forEach(el => {
const height = toFloat(css(el, 'minHeight'));
if (height && (this.forceHeight || Math.round(height) >= el.offsetHeight)) {
if (height && (this.forceHeight || Math.round(height) >= getHeight(el))) {
css(el, 'height', height);
}
});
Expand Down

0 comments on commit 297cf54

Please sign in to comment.