1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 16:25:06 +00:00

LibWeb: Stop parsing after document.write at the insertion point

If a call to `document.write` inserts an incomplete HTML tag, e.g.:

    document.write("<p");

we would previously continue parsing the document until we reached a
closing angle bracket. However, the spec states we should stop once we
reach the new insertion point.
This commit is contained in:
Timothy Flynn 2024-02-18 12:45:53 -05:00 committed by Andreas Kling
parent 64dcd3f1f4
commit af57bd5cca
7 changed files with 62 additions and 10 deletions

View file

@ -111,7 +111,11 @@ public:
#undef __ENUMERATE_TOKENIZER_STATE
};
Optional<HTMLToken> next_token();
enum class StopAtInsertionPoint {
No,
Yes,
};
Optional<HTMLToken> next_token(StopAtInsertionPoint = StopAtInsertionPoint::No);
void set_parser(Badge<HTMLParser>, HTMLParser& parser) { m_parser = &parser; }