Skip to content

Commit e7554d6

Browse files
committed
fix: set matchMedia on window to fix issue on IE11, fixes #11358
1 parent 137ce79 commit e7554d6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

js/foundation.util.mediaQuery.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const defaultQueries = {
1818

1919
// matchMedia() polyfill - Test a CSS media type/query in JS.
2020
// Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license
21-
let matchMedia = window.matchMedia || (function() {
21+
window.matchMedia = window.matchMedia || (function() {
2222
'use strict';
2323

2424
// For browsers that support matchMedium api such as IE 9 and webkit
@@ -109,7 +109,7 @@ var MediaQuery = {
109109
var query = this.get(size);
110110

111111
if (query) {
112-
return matchMedia(query).matches;
112+
return window.matchMedia(query).matches;
113113
}
114114

115115
return false;
@@ -160,7 +160,7 @@ var MediaQuery = {
160160
for (var i = 0; i < this.queries.length; i++) {
161161
var query = this.queries[i];
162162

163-
if (matchMedia(query.value).matches) {
163+
if (window.matchMedia(query.value).matches) {
164164
matched = query;
165165
}
166166
}

0 commit comments

Comments
 (0)