Skip to content

Commit 5ad2e74

Browse files
committed
Fix BrowserSync IE error
1 parent b6ed96e commit 5ad2e74

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

test/config/server.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,26 @@ function startServer(options = {}, cb = Function.prototype) {
4444
match: /<\/body>/i,
4545
fn: function (snippet, match) {
4646
// Override changelog alias to load local changelog (see routes)
47-
const injectJS = `
47+
const newSnippet = `
48+
${snippet.replace(/<script[^>]*/, '$& type="text/plain"')}
4849
<script>
49-
// Fix /docs site configuration during tests
5050
(function() {
51-
const aliasConfig = (window && window.$docsify && window.$docsify.alias) || {};
51+
var aliasConfig = (window && window.$docsify && window.$docsify.alias) || {};
52+
var isIE = /*@cc_on!@*/false || !!document.documentMode;
5253
54+
// Fix /docs site configuration during tests
5355
aliasConfig['.*?/changelog'] = '/changelog.md';
56+
57+
// Enable BrowserSync snippet for non-IE browsers
58+
if (!isIE) {
59+
document.querySelector('#__bs_script__').removeAttribute('type');
60+
}
5461
})();
5562
</script>
63+
${match}
5664
`;
5765

58-
return injectJS + snippet + match;
66+
return newSnippet;
5967
},
6068
},
6169
},

0 commit comments

Comments
 (0)