[wp-trac] [WordPress Trac] #61009: HTML API: Preserve some additional invalid HTML comment syntaxes.

WordPress Trac noreply at wordpress.org
Mon Apr 15 14:35:01 UTC 2024


#61009: HTML API: Preserve some additional invalid HTML comment syntaxes.
--------------------------+-----------------------------------
 Reporter:  dmsnell       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  HTML API      |    Version:  trunk
 Severity:  normal        |   Keywords:  has-patch 2nd-opinion
  Focuses:                |
--------------------------+-----------------------------------
 When `wp_kses_split` processes a document it attempts to leave HTML
 comments relatively alone. It makes minor adjustments, but leaves the
 comments in the document in its output.

 Unfortunately it only recognizes one kind of HTML comment and rejects many
 other kinds which appear as the result of various invalid HTML markup.

 This patch makes a minor adjustment to the algorithm in `wp_kses_split` to
 allow two additional kinds of HTML comments:

  - HTML comments with the incorrect closer `--!>`.
  - Closing tags with an invalid tag name, e.g. `</%dolly>`.

 In an HTML parser these all become comments, and so leaving them in the
 document should be a benign operation, improving the reliability of
 detecting comments in Core. These invalid closing tags, which in a browser
 are interpreted as comments, are one proposal for a placeholder mechanism
 in the HTML API unlocking HTML templating, a new kind of shortcode, and
 more. Having these persist in Core is a requirement for exploring and
 utilizing the new syntax.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61009>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list