Skip to content

Commit

Permalink
fix: Ignore case when checking script's type
Browse files Browse the repository at this point in the history
  • Loading branch information
d3xter666 committed Apr 9, 2024
1 parent 85c0fe1 commit c191462
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/detectors/transpilers/html/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ export async function extractJSScriptTags(contentStream: ReadStream) {
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type#attribute_is_not_set_default_an_empty_string_or_a_javascript_mime_type
return attr.name.value !== "type" ||
(attr.name.value === "type" &&
(attr.value.value === "" || attr.value.value === "text/javascript"));
["",
"text/javascript",
"application/javascript", /* legacy */
].includes(attr.value.value.toLowerCase()));
});

if (isJSScriptTag) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,17 @@
</mvc:View>
</script>

<script type="module">
import { log } from "utils";

log("Exporting dog names.");

export const names = ["Kayla", "Bentley", "Gilligan"];
</script>

<script type="" src="./path/to/js.js"></script>

<script src="./another/path/to/js.js"></script>
</body>

</html>
</html>

0 comments on commit c191462

Please sign in to comment.