Fix synchronous loading for ES5 build (#17174)

pull/17591/head
Steve Repsher 2023-08-15 13:48:51 -04:00 committed by GitHub
parent cba246fc7f
commit 88ff4c2fa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 20 deletions

View File

@ -1,18 +1,23 @@
<script>
function _ls(src) {
var doc = document.documentElement;
var script = doc.insertBefore(
document.createElement("script"),
doc.lastChild
);
script.defer = true;
script.src = src;
return script;
}
window.polymerSkipLoadingFontRoboto = true;
if (!("customElements" in window &&
"content" in document.createElement("template"))) {
document.write("<script src='/static/polyfills/webcomponents-bundle.js'><"+"/script>");
}
var isS11_12 = /(?:.*(?:iPhone|iPad).*OS (?:11|12)_\d)|(?:.*Version\/(?:11|12)(?:\.\d+)*.*Safari\/)/.test(navigator.userAgent);
</script>
<script>
function _ls(src, sync) {
var script = document.createElement("script");
if (sync) {
script.async = false;
}
script.src = src;
return document.head.appendChild(script);
}
window.polymerSkipLoadingFontRoboto = true;
if (
!(
"customElements" in window &&
"content" in document.createElement("template")
)
) {
_ls("/static/polyfills/webcomponents-bundle.js", true);
}
var isS11_12 =
/(?:.*(?:iPhone|iPad).*OS (?:11|12)_\d)|(?:.*Version\/(?:11|12)(?:\.\d+)*.*Safari\/)/.test(
navigator.userAgent
);
</script>

View File

@ -9,7 +9,7 @@
}
<% } else { %>
<% for (const entry of es5EntryJS) { %>
_ls("<%= entry %>");
_ls("<%= entry %>", true);
<% } %>
<% } %>
}

View File

@ -112,7 +112,7 @@
}
<% } else { %>
<% for (const entry of es5EntryJS) { %>
_ls("<%= entry %>");
_ls("<%= entry %>", true);
<% } %>
<% } %>
}