Skip to content

Commit ec88b3f

Browse files
committed
fix: Modal NodeList.forEach error in IE 11 (fixed #395)
1 parent facb818 commit ec88b3f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/utils/dom.utils.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { isExist, isString, isFunction } from './object.utils'
2+
import { nodeListToArray } from './array.utils'
23

34
export const EVENTS = {
45
MOUSE_ENTER: 'mouseenter',
@@ -337,7 +338,7 @@ export function toggleBodyOverflow (enable) {
337338
if (enable) {
338339
removeClass(body, MODAL_OPEN)
339340
body.style.paddingRight = null
340-
document.querySelectorAll(FIXED_CONTENT).forEach(node => {
341+
nodeListToArray(document.querySelectorAll(FIXED_CONTENT)).forEach(node => {
341342
node.style.paddingRight = null
342343
})
343344
} else {
@@ -346,7 +347,7 @@ export function toggleBodyOverflow (enable) {
346347
if (documentHasScrollbar && !browsersWithFloatingScrollbar) {
347348
const scrollbarWidth = getScrollbarWidth()
348349
body.style.paddingRight = `${scrollbarWidth}px`
349-
document.querySelectorAll(FIXED_CONTENT).forEach(node => {
350+
nodeListToArray(document.querySelectorAll(FIXED_CONTENT)).forEach(node => {
350351
node.style.paddingRight = `${scrollbarWidth}px`
351352
})
352353
}

0 commit comments

Comments
 (0)