Skip to content

TypeError in HTML parser when parsing a custom element followed by a prototype #15511

@jasikpark

Description

@jasikpark

Prettier 3.0.3
Playground link

# Options (if any):

Input:

<constructor>prototpyeo

Output:

TypeError: u(A).getContentType is not a function. (In 'u(A).getContentType()', 'u(A).getContentType' is undefined)
o@https://prettier.io/lib/plugins/html.js:17:16572
_consumeTagOpen@https://prettier.io/lib/plugins/html.js:17:6729
tokenize@https://prettier.io/lib/plugins/html.js:17:511
As@https://prettier.io/lib/plugins/html.js:16:27954
parse@https://prettier.io/lib/plugins/html.js:17:16590
ks@https://prettier.io/lib/plugins/html.js:19:14585
Bs@https://prettier.io/lib/plugins/html.js:19:17013
@https://prettier.io/lib/standalone.js:25:13319

Expected behavior:

The parser either throws an expected error "invalid HTML", or it reasonably parses the input without error.

Discovered via https://github.com/jasikpark/fuzz-prettier, my messy attempt at fuzzing prettier and its plugin formatters, hope this is helpful 👍

Metadata

Metadata

Assignees

Labels

lang:htmlIssues affecting HTML (and SVG but not JSX)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions