Indicates if the matched delimiter is an HTML span and comprises more than whitespace characters, i.e. contains real content.
Description
Many block serializers introduce newlines between block delimiters, so the presence of top-level non-block content does not imply that there are “real” freeform HTML blocks. Checking if there is content beyond whitespace is a more certain check, such as for determining whether to load CSS for the freeform or fallback block type.
See also
Source
public function is_non_whitespace_html(): bool {
if ( ! $this->is_html() ) {
return false;
}
$length = $this->matched_delimiter_at - $this->after_previous_delimiter;
$whitespace_length = strspn(
$this->source_text,
" \t\f\r\n",
$this->after_previous_delimiter,
$length
);
return $whitespace_length !== $length;
}
Changelog
| Version | Description |
|---|---|
| 6.9.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.