Skip to content

Commit 398ccf7

Browse files
committed
fix: workaround for mozilla bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=548397 window.getComputedStyle() returns null inside an iframe with display: none
1 parent fed09b9 commit 398ccf7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/utils.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ export const events = {
1818

1919
export const vendorPrefix = (function () {
2020
if (typeof window === 'undefined' || typeof document === 'undefined') return ''; // server environment
21-
let styles = window.getComputedStyle(document.documentElement, '');
21+
// fix for:
22+
// https://bugzilla.mozilla.org/show_bug.cgi?id=548397
23+
// window.getComputedStyle() returns null inside an iframe with display: none
24+
// in this case return an array with a fake mozilla style in it.
25+
let styles = window.getComputedStyle(document.documentElement, '') || ['-moz-hidden-iframe'];
2226
const pre = (Array.prototype.slice
2327
.call(styles)
2428
.join('')

0 commit comments

Comments
 (0)