Fix synchronous loading for ES5 build (#17174)

This commit is contained in:
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> <script>
function _ls(src) { function _ls(src, sync) {
var doc = document.documentElement; var script = document.createElement("script");
var script = doc.insertBefore( if (sync) {
document.createElement("script"), script.async = false;
doc.lastChild }
); script.src = src;
script.defer = true; return document.head.appendChild(script);
script.src = src; }
return script; window.polymerSkipLoadingFontRoboto = true;
} if (
window.polymerSkipLoadingFontRoboto = true; !(
if (!("customElements" in window && "customElements" in window &&
"content" in document.createElement("template"))) { "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); _ls("/static/polyfills/webcomponents-bundle.js", true);
</script> }
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 { %> <% } else { %>
<% for (const entry of es5EntryJS) { %> <% for (const entry of es5EntryJS) { %>
_ls("<%= entry %>"); _ls("<%= entry %>", true);
<% } %> <% } %>
<% } %> <% } %>
} }

View File

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