Skip to content

Commit

Permalink
remove reflow which do not add anything
Browse files Browse the repository at this point in the history
  • Loading branch information
Johann-S committed Feb 24, 2019
1 parent c738b5f commit b8a7647
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 23 deletions.
3 changes: 0 additions & 3 deletions js/src/carousel.js
Expand Up @@ -13,7 +13,6 @@ import {
getTransitionDurationFromElement,
isVisible,
makeArray,
reflow,
triggerTransitionEnd,
typeCheckConfig
} from './util/index'
Expand Down Expand Up @@ -468,8 +467,6 @@ class Carousel {
this._setActiveIndicatorElement(nextElement)

if (this._element.classList.contains(ClassName.SLIDE)) {
reflow(nextElement)

nextElement.classList.add(orderClassName)
activeElement.classList.add(directionalClassName)
nextElement.classList.add(directionalClassName)
Expand Down
3 changes: 0 additions & 3 deletions js/src/collapse.js
Expand Up @@ -13,7 +13,6 @@ import {
getTransitionDurationFromElement,
isElement,
makeArray,
reflow,
typeCheckConfig
} from './util/index'
import Data from './dom/data'
Expand Down Expand Up @@ -234,8 +233,6 @@ class Collapse {

this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`

reflow(this._element)

this._element.classList.add(ClassName.COLLAPSING)
this._element.classList.remove(ClassName.COLLAPSE)
this._element.classList.remove(ClassName.SHOW)
Expand Down
9 changes: 0 additions & 9 deletions js/src/modal.js
Expand Up @@ -13,7 +13,6 @@ import {
getTransitionDurationFromElement,
isVisible,
makeArray,
reflow,
typeCheckConfig
} from './util/index'
import Data from './dom/data'
Expand Down Expand Up @@ -261,10 +260,6 @@ class Modal {
this._element.scrollTop = 0
}

if (transition) {
reflow(this._element)
}

this._element.classList.add(ClassName.SHOW)

if (this._config.focus) {
Expand Down Expand Up @@ -373,10 +368,6 @@ class Modal {
}
})

if (animate) {
reflow(this._backdrop)
}

this._backdrop.classList.add(ClassName.SHOW)

if (!callback) {
Expand Down
5 changes: 1 addition & 4 deletions js/src/tab.js
Expand Up @@ -11,8 +11,7 @@ import {
emulateTransitionEnd,
getSelectorFromElement,
getTransitionDurationFromElement,
makeArray,
reflow
makeArray
} from './util/index'
import Data from './dom/data'
import EventHandler from './dom/eventHandler'
Expand Down Expand Up @@ -191,8 +190,6 @@ class Tab {
element.setAttribute('aria-selected', true)
}

reflow(element)

if (element.classList.contains(ClassName.FADE)) {
element.classList.add(ClassName.SHOW)
}
Expand Down
5 changes: 1 addition & 4 deletions js/src/util/index.js
Expand Up @@ -157,8 +157,6 @@ const findShadowRoot = (element) => {
// eslint-disable-next-line no-empty-function
const noop = () => function () {}

const reflow = (element) => element.offsetHeight

export {
jQuery,
TRANSITION_END,
Expand All @@ -172,6 +170,5 @@ export {
makeArray,
isVisible,
findShadowRoot,
noop,
reflow
noop
}

0 comments on commit b8a7647

Please sign in to comment.