MCPcopy Create free account
hub / github.com/observablehq/framework / isJavaScript

Function isJavaScript

src/html.ts:32–36  ·  view source on GitHub ↗
({type}: HTMLScriptElement)

Source from the content-addressed store, hash-verified

30];
31
32export function isJavaScript({type}: HTMLScriptElement): boolean {
33 if (!type) return true;
34 type = type.toLowerCase();
35 return type === "text/javascript" || type === "application/javascript" || type === "module";
36}
37
38export function parseHtml(html: string): DOMWindow {
39 return new JSDOM(`<!DOCTYPE html><body>${html}`, {virtualConsole: new VirtualConsole()}).window;

Callers 5

renderModulePreloadFunction · 0.70
findAssetsFunction · 0.70
rewriteHtmlFunction · 0.70
getResolversFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected