Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HTML API: Join text nodes on invalid-tag-name boundaries.
A fix was introduced to the Tag Processor to ensure that contiguous text in an HTML document emerges as a single text node spanning the full sequence. Unfortunately, that patch was marginally over-zealous in checking if a "<" started a syntax token or not. It used the following: ``` if ( 'A' <= $c && 'z' >= $c ) { ... } ``` This was based on the assumption that the A-Z and a-z letters are contiguous in the ASCII range; they aren't, and there's a gap of several characters in between. The result of this is that in some cases the parser created a text boundary when it didn't need to. Text boundaries can be surprising and can be created when reaching invalid syntax, HTML comments, and more hidden elements, so semantically this wasn't a major bug, but it was an aesthetic challenge. In this patch the check is properly compared for both upper- and lower-case variants that could potentially form tag names. ``` if ( ( 'A' <= $c && 'Z' >= $c ) || ( 'a' <= $c && 'z' >= $c ) ) { ... } ``` This solves the problem and ensures that contiguous text appears as a single text node when scanning tokens. Follow-up to [57489] Props dmsnell, jonsurrell See Core-60385 Co-authored-by: Jon Surrell <sirreal@users.noreply.github.com>
- Loading branch information