Make WordPress Core

Opened 7 weeks ago

Last modified 7 weeks ago

#65576 new enhancement

Duotone: Use HTML API class_list for duotone wrapper class handling (backport)

Reported by: jonsurrell Owned by:
Priority: normal Milestone: Awaiting Review
Component: Editor Version:
Severity: minor Keywords: has-patch has-unit-tests
Cc: Focuses:

Description (last modified by jonsurrell)

Backport Gutenberg change https://github.com/WordPress/gutenberg/pull/79531

Updates WP_Duotone_Gutenberg::restore_image_outer_container() to use WP_HTML_Tag_Processor::class_list() instead of manually reading and splitting the class attribute.

Adds unit coverage for moving a generated wp-duotone* class from the inner image figure to the restored outer .wp-block-image wrapper in classic themes.

Follow-up to [58313].

See https://core.trac.wordpress.org/ticket/65466#comment:2.

The tag processor already provides class-specific APIs, which handle HTML class-list semantics more directly than custom string parsing.

Change History (2)

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


7 weeks ago
#1

  • Keywords has-patch has-unit-tests added

Ports the matching Gutenberg change to Core: https://github.com/WordPress/gutenberg/pull/79531.

Follow-up to r58313.

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

## What?

Follow-up to https://github.com/WordPress/gutenberg/pull/59764.

Updates WP_Duotone_Gutenberg::restore_image_outer_container() to use WP_HTML_Tag_Processor::class_list() instead of manually reading and splitting the class attribute.

Adds unit coverage for moving a generated wp-duotone* class from the inner image figure to the restored outer .wp-block-image wrapper in classic themes.

## Why?

The tag processor already provides class-specific APIs, which handle HTML class-list semantics more directly than custom string parsing.

## How?

  • Replaces explode( ' ', $tags->get_attribute( 'class' ) ) with $tags->class_list().
  • Adds PHPUnit coverage for the classic-theme duotone wrapper behavior.
  • Moves fixture theme setup/teardown into the test lifecycle, matching nearby theme-dependent tests.

## Testing Instructions

  1. Run vendor/bin/phpunit --filter WP_Duotone_Gutenberg_Test.
  2. Run vendor/bin/phpcs lib/class-wp-duotone-gutenberg.php phpunit/class-wp-duotone-test.php.

## Use of AI Tools

OpenAI Codex was used to assist with the code changes and PR description. The author is responsible for reviewing the final changes.

Trac ticket:

## Use of AI Tools

#2 @jonsurrell
7 weeks ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.