Skip to content

Commit

Permalink
Parse <script type=application/json> as JSON
Browse files Browse the repository at this point in the history
This extends 3fd4636 to also support
application/json and subtypes of it as JSON.

FIX: Parse `script` tags with `application/json` type as JSON syntax.

Ref: https://crbug.com/1505381
  • Loading branch information
bmeurer committed Nov 27, 2023
1 parent a52e026 commit 9243968
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ const defaultNesting: NestedLang[] = [
attrs: attrs => attrs.type == "text/typescript-jsx",
parser: tsxLanguage.parser},
{tag: "script",
attrs: attrs => attrs.type == "importmap" || attrs.type == "speculationrules",
attrs(attrs) {
return /^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(attrs.type)
},
parser: jsonParser},
{tag: "script",
attrs(attrs) {
Expand Down

0 comments on commit 9243968

Please sign in to comment.