[wp-trac] [WordPress Trac] #61257: HTML API: Indicate if a matched element expects a closing tag/token.

WordPress Trac noreply at wordpress.org
Fri May 24 01:19:25 UTC 2024


#61257: HTML API: Indicate if a matched element expects a closing tag/token.
-----------------------------+----------------------
 Reporter:  dmsnell          |       Owner:  dmsnell
     Type:  feature request  |      Status:  closed
 Priority:  normal           |   Milestone:  6.6
Component:  HTML API         |     Version:  trunk
 Severity:  normal           |  Resolution:  fixed
 Keywords:  has-patch        |     Focuses:
-----------------------------+----------------------
Changes (by dmsnell):

 * owner:  (none) => dmsnell
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"58192" 58192]:
 {{{
 #!CommitTicketReference repository="" revision="58192"
 HTML API: Add `expects_closer()` method to HTML Processor

 This patch adds a new method, `WP_HTML_Processor->expects_closer()` to
 indicate
 if the currently-matched node expects to find a closing token. For
 example, a
 `DIV` element expects a closing `</div>` tag, but an `<img>` expects none,
 because
 it's a void element. Similarly, `#text` nodes and HTML comments only
 appear as
 unitary nodes on the stack of open elements. Once proceeding further in
 the
 document they are immediately removed without any closing tag.

 This new method serves as a helper to indicate whether or not to expect
 the
 closer, as this can be more complicated than it seems, and calling code
 shouldn't have to build custom interpretations and implementations.
 Instead,
 the HTML Processor ought to export its internal knowledge to make it easy
 for
 consuming code and projects.

 Developed in https://github.com/WordPress/wordpress-develop/pull/6600
 Discussed in https://core.trac.wordpress.org/ticket/61257

 Fixes #61257.
 Props dmsnell, jonsurrell.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61257#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list