Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse WP_HTML_Processor::is_void() now that WP 6.5 is minimum supported version #1115

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 2 additions & 32 deletions plugins/optimization-detective/class-od-html-tag-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,6 @@
*/
final class OD_HTML_Tag_Processor {

/**
* HTML void tags (i.e. those which are self-closing).
*
* @link https://html.spec.whatwg.org/multipage/syntax.html#void-elements
* @see WP_HTML_Processor::is_void()
* @todo Reuse `WP_HTML_Processor::is_void()` once WordPress 6.4 is the minimum-supported version.
*
* @var string[]
*/
const VOID_TAGS = array(
'AREA',
'BASE',
'BASEFONT', // Obsolete.
'BGSOUND', // Obsolete.
'BR',
'COL',
'EMBED',
'FRAME', // Deprecated.
'HR',
'IMG',
'INPUT',
'KEYGEN', // Obsolete.
'LINK',
'META',
'PARAM', // Deprecated.
'SOURCE',
'TRACK',
'WBR',
);

/**
* Raw text tags.
*
Expand Down Expand Up @@ -225,7 +195,7 @@ public function open_tags(): Generator {

// Immediately pop off self-closing and raw text tags.
if (
in_array( $tag_name, self::VOID_TAGS, true )
WP_HTML_Processor::is_void( $tag_name )
||
in_array( $tag_name, self::RAW_TEXT_TAGS, true )
||
Expand All @@ -236,7 +206,7 @@ public function open_tags(): Generator {
} else {
// If the closing tag is for self-closing or raw text tag, we ignore it since it was already handled above.
if (
in_array( $tag_name, self::VOID_TAGS, true )
WP_HTML_Processor::is_void( $tag_name )
||
in_array( $tag_name, self::RAW_TEXT_TAGS, true )
) {
Expand Down
1 change: 1 addition & 0 deletions plugins/optimization-detective/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ The [plugin source code](https://github.com/WordPress/performance/tree/trunk/plu
= 0.1.1 =

* Use plugin slug for generator tag. ([1103](https://github.com/WordPress/performance/pull/1103))
* Reuse `WP_HTML_Processor::is_void()` now that WP 6.4 is minimum supported version. ([1115](https://github.com/WordPress/performance/pull/1115))

= 0.1.0 =

Expand Down
Loading