Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#57642 closed enhancement (fixed)

Updates `wp_render_elements_support()` to use the HTML API

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

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
4 years ago

  • Summary Backport updates to `wp_render_elements_support` → Backport updates to `wp_render_elements_support` to use html API

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


4 years 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
4 years ago

  • Description modified (diff)

#4 @hellofromTonya
4 years ago

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

#5 @flixos90
4 years ago

  • Owner set to flixos90
  • Status new → reviewing
  • Type defect (bug) → 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
4 years ago

  • Resolution → fixed
  • Status reviewing → 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.