Skip to content

Commit

Permalink
Fix wrong null check on document.currentScript
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda committed May 13, 2023
1 parent feb75a2 commit 15ca11b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/cli-support/src/js/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ impl<'a> Context<'a> {
js.push_str("let script_src;\n");
js.push_str(
"\
if (typeof document !== 'undefined' && typeof document.currentScript !== 'null') {
if (typeof document !== 'undefined' && document.currentScript !== null) {
script_src = new URL(document.currentScript.src, location.href).toString();
}\n",
);
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/wasm-bindgen/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ fn default_module_path_target_no_modules() {
fs::read_to_string(out_dir.join("default_module_path_target_no_modules.js")).unwrap();
assert!(contents.contains(
"\
if (typeof document !== 'undefined' && typeof document.currentScript !== 'null') {
if (typeof document !== 'undefined' && document.currentScript !== null) {
script_src = new URL(document.currentScript.src, location.href).toString();
}",
));
Expand Down

0 comments on commit 15ca11b

Please sign in to comment.