WP_HTML_Tag_Processor::get_qualified_tag_name()publicWP 6.7.0

Returns the adjusted tag name for a given token, taking into account the current parsing context, whether HTML, SVG, or MathML.

Method of the class: WP_HTML_Tag_Processor{}

No Hooks.

Return

String|null. Name of current tag name.

Usage

$WP_HTML_Tag_Processor = new WP_HTML_Tag_Processor();
$WP_HTML_Tag_Processor->get_qualified_tag_name(): ?string;

Changelog

Since 6.7.0 Introduced.

WP_HTML_Tag_Processor::get_qualified_tag_name() code WP 6.7.1

public function get_qualified_tag_name(): ?string {
	$tag_name = $this->get_tag();
	if ( null === $tag_name ) {
		return null;
	}

	if ( 'html' === $this->get_namespace() ) {
		return $tag_name;
	}

	$lower_tag_name = strtolower( $tag_name );
	if ( 'math' === $this->get_namespace() ) {
		return $lower_tag_name;
	}

	if ( 'svg' === $this->get_namespace() ) {
		switch ( $lower_tag_name ) {
			case 'altglyph':
				return 'altGlyph';

			case 'altglyphdef':
				return 'altGlyphDef';

			case 'altglyphitem':
				return 'altGlyphItem';

			case 'animatecolor':
				return 'animateColor';

			case 'animatemotion':
				return 'animateMotion';

			case 'animatetransform':
				return 'animateTransform';

			case 'clippath':
				return 'clipPath';

			case 'feblend':
				return 'feBlend';

			case 'fecolormatrix':
				return 'feColorMatrix';

			case 'fecomponenttransfer':
				return 'feComponentTransfer';

			case 'fecomposite':
				return 'feComposite';

			case 'feconvolvematrix':
				return 'feConvolveMatrix';

			case 'fediffuselighting':
				return 'feDiffuseLighting';

			case 'fedisplacementmap':
				return 'feDisplacementMap';

			case 'fedistantlight':
				return 'feDistantLight';

			case 'fedropshadow':
				return 'feDropShadow';

			case 'feflood':
				return 'feFlood';

			case 'fefunca':
				return 'feFuncA';

			case 'fefuncb':
				return 'feFuncB';

			case 'fefuncg':
				return 'feFuncG';

			case 'fefuncr':
				return 'feFuncR';

			case 'fegaussianblur':
				return 'feGaussianBlur';

			case 'feimage':
				return 'feImage';

			case 'femerge':
				return 'feMerge';

			case 'femergenode':
				return 'feMergeNode';

			case 'femorphology':
				return 'feMorphology';

			case 'feoffset':
				return 'feOffset';

			case 'fepointlight':
				return 'fePointLight';

			case 'fespecularlighting':
				return 'feSpecularLighting';

			case 'fespotlight':
				return 'feSpotLight';

			case 'fetile':
				return 'feTile';

			case 'feturbulence':
				return 'feTurbulence';

			case 'foreignobject':
				return 'foreignObject';

			case 'glyphref':
				return 'glyphRef';

			case 'lineargradient':
				return 'linearGradient';

			case 'radialgradient':
				return 'radialGradient';

			case 'textpath':
				return 'textPath';

			default:
				return $lower_tag_name;
		}
	}

	// This unnecessary return prevents tools from inaccurately reporting type errors.
	return $tag_name;
}