Skip to content

Commit

Permalink
Change property readers to camelCasing
Browse files Browse the repository at this point in the history
The casing of the `<script>` element's [crossorigin][] and
[referrerpolicy][] HTML _attributes_ differ from the casing of
[HTMLScriptElement.crossOrigin][] and
[HTMLScriptElement.referrerPolicy][] _properties_.

Prior to this commit, the implementation erroneously attempted to read
values from the _properties_ through names cased as if they were
_attributes_.

This commit replaces the lower-cased accesses with camelCased ones.

[crossorigin]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-crossorigin
[referrerpolicy]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-referrerpolicy
[HTMLScriptElement.crossOrigin]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement#instance_properties
[HTMLScriptElement.referrerPolicy]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement/referrerPolicy
  • Loading branch information
seanpdoyle committed Jan 9, 2023
1 parent 1c93968 commit 83b83ff
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/es-module-shims.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ function getOrCreateLoad (url, fetchOpts, parent, source) {
const { r, b } = await resolve(n, load.r || load.u);
if (b && (!supportsImportMaps || importMapSrcOrLazy))
load.n = true;
if (d !== -1) return;
if (d !== -1) return;
if (skip && skip(r)) return { b: r };
if (childFetchOpts.integrity)
childFetchOpts = Object.assign({}, childFetchOpts, { integrity: undefined });
Expand All @@ -477,11 +477,11 @@ function getFetchOpts (script) {
const fetchOpts = {};
if (script.integrity)
fetchOpts.integrity = script.integrity;
if (script.referrerpolicy)
if (script.referrerPolicy)
fetchOpts.referrerPolicy = script.referrerpolicy;
if (script.crossorigin === 'use-credentials')
if (script.crossOrigin === 'use-credentials')
fetchOpts.credentials = 'include';
else if (script.crossorigin === 'anonymous')
else if (script.crossOrigin === 'anonymous')
fetchOpts.credentials = 'omit';
else
fetchOpts.credentials = 'same-origin';
Expand Down

0 comments on commit 83b83ff

Please sign in to comment.