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: {{{ <?php 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. {{{ <?php 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. Developed in #6041 Discussed in https://core.trac.wordpress.org/ticket/60385 Follow-up to [57489] Props dmsnell, jonsurrell Fixes #60385 git-svn-id: https://develop.svn.wordpress.org/trunk@57542 602fd350-edb4-49c9-b593-d223f7449a82
- Loading branch information