[wp-trac] [WordPress Trac] #57642: Updates `wp_render_elements_support()` to use the HTML API (was: Backport updates to `wp_render_elements_support` to use html API)

WordPress Trac noreply at wordpress.org
Mon Feb 6 14:48:10 UTC 2023


#57642: Updates `wp_render_elements_support()` to use the HTML API
-------------------------------------------------+-------------------------
 Reporter:  ntsekouras                           |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  6.2
Component:  Editor                               |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  gutenberg-merge has-patch has-unit-  |     Focuses:
  tests                                          |
-------------------------------------------------+-------------------------
Changes (by hellofromTonya):

 * keywords:  gutenberg-merge has-patch => gutenberg-merge has-patch has-
     unit-tests
 * milestone:  Awaiting Review => 6.2


Old description:

> We need to update `wp_render_elements_support` to use the new html API
> (`WP_HTML_Tag_Processor`).
>
> Related GB PR: https://github.com/WordPress/gutenberg/pull/46625

New description:

 Replaces the RegEx and PHP string functionality in
 `wp_render_elements_support()` to use the new HTML API
 (`WP_HTML_Tag_Processor`).

 Why?

 >This class was built to quickly and reliably modify HTML tag attributes.
 It circumvents specific problems, such as matching on the wrong attributes
 (such as data-custom-class="some value"), overlooking matches (such as
 class=blue or class='wp-block-group'), writing updates in a way that get
 overlooked by the browser (by writing to the end of the tag instead of
 before any potential duplicate attributes), and by writing invalid content
 to the HTML (such as through a bug in a PCRE pattern greedily matching
 more than it should).

 Reference:
 * [https://github.com/WordPress/gutenberg/pull/46625 Gutenberg PR 46625]

--

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


More information about the wp-trac mailing list