Skip to content

Commit fe601cf

Browse files
🐛 Merge pull request #541 from titanism/master
fix: fixed readyState
2 parents 0161cba + 3037577 commit fe601cf

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/client.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,14 @@ import * as sapper from '@sapper/app';
55
// if we do not use this then we need to move sapper at end of <body>
66
// <https://caniuse.com/domcontentloaded>
77
//
8-
document.addEventListener('DOMContentLoaded', function() {
8+
if (document.readyState !== 'loading') {
99
sapper.start({
1010
target: document.querySelector('#sapper')
1111
});
12-
});
12+
} else {
13+
document.addEventListener('DOMContentLoaded', function() {
14+
sapper.start({
15+
target: document.querySelector('#sapper')
16+
});
17+
});
18+
}

0 commit comments

Comments
 (0)