WP_HTML_Processor::is_void()public staticWP 6.4.0

Returns whether a given element is an HTML Void Element

area, base, br, col, embed, hr, img, input, link, meta, source, track, wbr

Метод класса: WP_HTML_Processor{}

Хуков нет.

Возвращает

true|false. Whether the given tag is an HTML Void Element.

Использование

$result = WP_HTML_Processor::is_void( $tag_name );
$tag_name(строка) (обязательный)
Name of HTML tag to check.

Заметки

Список изменений

С версии 6.4.0 Введена.

Код WP_HTML_Processor::is_void() WP 6.6.2

public static function is_void( $tag_name ) {
	$tag_name = strtoupper( $tag_name );

	return (
		'AREA' === $tag_name ||
		'BASE' === $tag_name ||
		'BASEFONT' === $tag_name || // Obsolete but still treated as void.
		'BGSOUND' === $tag_name || // Obsolete but still treated as void.
		'BR' === $tag_name ||
		'COL' === $tag_name ||
		'EMBED' === $tag_name ||
		'FRAME' === $tag_name ||
		'HR' === $tag_name ||
		'IMG' === $tag_name ||
		'INPUT' === $tag_name ||
		'KEYGEN' === $tag_name || // Obsolete but still treated as void.
		'LINK' === $tag_name ||
		'META' === $tag_name ||
		'PARAM' === $tag_name || // Obsolete but still treated as void.
		'SOURCE' === $tag_name ||
		'TRACK' === $tag_name ||
		'WBR' === $tag_name
	);
}