@@ -34,44 +34,20 @@ export const patchBrowser = (): Promise<d.CustomElementsDefineOptions> => {
34
34
}
35
35
36
36
// @ts -ignore
37
- const scriptElm =
38
- // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
39
- BUILD . scriptDataOpts || BUILD . safari10
40
- ? Array . from ( doc . querySelectorAll ( 'script' ) ) . find (
41
- ( s ) =>
42
- new RegExp ( `\/${ NAMESPACE } (\\.esm)?\\.js($|\\?|#)` ) . test ( s . src ) ||
43
- s . getAttribute ( 'data-stencil-namespace' ) === NAMESPACE
44
- )
45
- : null ;
37
+ const scriptElm = BUILD . scriptDataOpts
38
+ ? Array . from ( doc . querySelectorAll ( 'script' ) ) . find (
39
+ ( s ) =>
40
+ new RegExp ( `\/${ NAMESPACE } (\\.esm)?\\.js($|\\?|#)` ) . test ( s . src ) ||
41
+ s . getAttribute ( 'data-stencil-namespace' ) === NAMESPACE
42
+ )
43
+ : null ;
46
44
const importMeta = import . meta. url ;
47
45
const opts = BUILD . scriptDataOpts ? ( ( scriptElm as any ) || { } ) [ 'data-opts' ] || { } : { } ;
48
46
49
- // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
50
- if ( BUILD . safari10 && 'onbeforeload' in scriptElm && ! history . scrollRestoration /* IS_ESM_BUILD */ ) {
51
- // Safari < v11 support: This IF is true if it's Safari below v11.
52
- // This fn cannot use async/await since Safari didn't support it until v11,
53
- // however, Safari 10 did support modules. Safari 10 also didn't support "nomodule",
54
- // so both the ESM file and nomodule file would get downloaded. Only Safari
55
- // has 'onbeforeload' in the script, and "history.scrollRestoration" was added
56
- // to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.
57
- // IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.
58
- return {
59
- then ( ) {
60
- /* promise noop */
61
- } ,
62
- } as any ;
63
- }
64
-
65
- // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
66
- if ( ! BUILD . safari10 && importMeta !== '' ) {
47
+ if ( importMeta !== '' ) {
67
48
opts . resourcesUrl = new URL ( '.' , importMeta ) . href ;
68
- // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.
69
- } else if ( BUILD . safari10 ) {
70
- opts . resourcesUrl = new URL (
71
- '.' ,
72
- new URL ( scriptElm . getAttribute ( 'data-resources-url' ) || scriptElm . src , win . location . href )
73
- ) . href ;
74
49
}
50
+
75
51
return promiseResolve ( opts ) ;
76
52
} ;
77
53
0 commit comments