Skip to content

Commit f34abc5

Browse files
xxkl1baseballyama
andauthored
fix: decode html entities correctly (#8047)
fixes #8026 1. replace the big entities list with entities that have a ; at the end where valid (there are some exceptions) 2. construct two regexes from that entities list: one for HTML where it's strictly matched, one for attributes where it tries to match browser behavior by also allowing = / digit / character afterwards 3. decode character references with one of these regexes depending on this is an attribute value or not --------- Co-authored-by: Yuichiro Yamashita <[email protected]>
1 parent aa15a64 commit f34abc5

File tree

8 files changed

+2218
-1936
lines changed

8 files changed

+2218
-1936
lines changed

src/compiler/parse/state/tag.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ function read_sequence(parser: Parser, done: () => boolean, location: string): T
519519

520520
function flush(end: number) {
521521
if (current_chunk.raw) {
522-
current_chunk.data = decode_character_references(current_chunk.raw);
522+
current_chunk.data = decode_character_references(current_chunk.raw, true);
523523
current_chunk.end = end;
524524
chunks.push(current_chunk);
525525
}

src/compiler/parse/state/text.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default function text(parser: Parser) {
1919
end: parser.index,
2020
type: 'Text',
2121
raw: data,
22-
data: decode_character_references(data)
22+
data: decode_character_references(data, false)
2323
};
2424

2525
parser.current().children.push(node);

0 commit comments

Comments
 (0)