Skip to content

Commit

Permalink
HTML API: Avoid processing incomplete syntax elements.
Browse files Browse the repository at this point in the history
The HTML Tag Processor is able to know if it starts parsing a syntax element
and reaches the end of the document before it reaches the end of the element.
In these cases, after this patch, the processor will indicate this condition.

For example, when processing `<div><input type="te` there is an incomplete INPUT
element. The processor will fail to find the INPUT, it will pause right after
the DIV, and `paused_at_incomplete_token()` will return `true`.

This patch doesn't change any existing behaviors, but it adds the new method
to report on the final failure condition. It provides a mechanism for later
use to add chunked parsing to the class, wherein it will be possible to process
a document without having the entire document loaded in memory, for example
when processing unbuffered output.

This is also a necessary change for adding the ability to scan every token in
the document. Currently the Tag Processor only exposes tags as tokens, but it
will need to process `#text` nodes, HTML comments, and other markup in order
to enable behaviors in the HTML Processor and in refactors of existing HTML
processing in Core.
  • Loading branch information
dmsnell committed Dec 16, 2023
1 parent f2c78fe commit 35502ad
Show file tree
Hide file tree
Showing 2 changed files with 519 additions and 105 deletions.
Loading

0 comments on commit 35502ad

Please sign in to comment.