Make WordPress Core

Opened 22 months ago

Closed 22 months ago

Last modified 22 months ago

#57642 closed enhancement (fixed)

Updates `wp_render_elements_support()` to use the HTML API

Reported by: ntsekouras's profile ntsekouras Owned by: flixos90's profile flixos90
Milestone: 6.2 Priority: normal
Severity: normal Version:
Component: Editor Keywords: gutenberg-merge has-patch has-unit-tests
Focuses: Cc:

Description (last modified by hellofromTonya)

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:

Change History (7)

#1 @ntsekouras
22 months ago

  • Summary changed from Backport updates to `wp_render_elements_support` to Backport updates to `wp_render_elements_support` to use html API

This ticket was mentioned in PR #4007 on WordPress/wordpress-develop by @ntsekouras.


22 months ago
#2

  • Keywords has-patch added

Trac ticket: https://core.trac.wordpress.org/ticket/57642

Updates wp_render_elements_support to use the new html API.

Related GB PR: https://github.com/WordPress/gutenberg/pull/46625

#3 @ntsekouras
22 months ago

  • Description modified (diff)

#4 @hellofromTonya
22 months ago

  • Description modified (diff)
  • Keywords has-unit-tests added
  • Milestone changed from Awaiting Review to 6.2
  • Summary changed from Backport updates to `wp_render_elements_support` to use html API to Updates `wp_render_elements_support()` to use the HTML API

#5 @flixos90
22 months ago

  • Owner set to flixos90
  • Status changed from new to reviewing
  • Type changed from defect (bug) to enhancement

@ntsekouras Changing this to an enhancement as this isn't really a bug :)

I'm going to review this shortly, should be reasonable to commit today or tomorrow before the beta release; otherwise we may want to change it to a "task (blessed)".

#6 @flixos90
22 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 55235:

Editor: Use WP_HTML_Tag_Processor in wp_render_elements_support().

Props ntsekouras.
Fixes #57642.

Note: See TracTickets for help on using tickets.