Skip to content
Draft
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
16 changes: 3 additions & 13 deletions src/wp-includes/html-api/class-wp-html-tag-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -1183,25 +1183,15 @@ public function class_list() {

$is_quirks = self::QUIRKS_MODE === $this->compat_mode;

$at = 0;
$at = strspn( $class, " \t\f\r\n" );
while ( $at < strlen( $class ) ) {
// Skip past any initial boundary characters.
$at += strspn( $class, " \t\f\r\n", $at );
if ( $at >= strlen( $class ) ) {
return;
}

// Find the byte length until the next boundary.
$length = strcspn( $class, " \t\f\r\n", $at );
if ( 0 === $length ) {
return;
}

$name = str_replace( "\x00", "\u{FFFD}", substr( $class, $at, $length ) );
$name = str_replace( "\x00", "\u{FFFD}", substr( $class, $at, $length ) );
if ( $is_quirks ) {
$name = strtolower( $name );
}
$at += $length;
$at += $length + strspn( $class, " \t\f\r\n", $at + $length );

/*
* It's expected that the number of class names for a given tag is relatively small.
Expand Down
Loading