Skip to content

Commit 4ba41a8

Browse files
dmsnelldlh01
andcommitted
Rearrange function body to eliminate some awkward logic.
Co-authored-by: dlh01 <[email protected]>
1 parent 9041e57 commit 4ba41a8

1 file changed

Lines changed: 85 additions & 86 deletions

File tree

src/wp-includes/html-api/class-wp-html-tag-processor.php

Lines changed: 85 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -2862,135 +2862,134 @@ public function get_qualified_tag_name(): ?string {
28622862
return null;
28632863
}
28642864

2865-
if ( 'html' === $this->get_namespace() ) {
2866-
return strtolower( $tag_name );
2865+
$lower_tag_name = strtolower( $tag_name );
2866+
$namespace = $this->get_namespace();
2867+
2868+
switch ( $namespace ) {
2869+
case 'html':
2870+
case 'math':
2871+
return $lower_tag_name;
28672872
}
28682873

2869-
$lower_tag_name = strtolower( $tag_name );
2870-
if ( 'math' === $this->get_namespace() ) {
2874+
if ( 'svg' !== $namespace ) {
2875+
// This should be unreachable, but prevents tools from inaccurately reporting type errors.
28712876
return $lower_tag_name;
28722877
}
28732878

2874-
if ( 'svg' === $this->get_namespace() ) {
2875-
switch ( $lower_tag_name ) {
2876-
case 'altglyph':
2877-
return 'altGlyph';
2879+
switch ( $lower_tag_name ) {
2880+
case 'altglyph':
2881+
return 'altGlyph';
28782882

2879-
case 'altglyphdef':
2880-
return 'altGlyphDef';
2883+
case 'altglyphdef':
2884+
return 'altGlyphDef';
28812885

2882-
case 'altglyphitem':
2883-
return 'altGlyphItem';
2886+
case 'altglyphitem':
2887+
return 'altGlyphItem';
28842888

2885-
case 'animatecolor':
2886-
return 'animateColor';
2889+
case 'animatecolor':
2890+
return 'animateColor';
28872891

2888-
case 'animatemotion':
2889-
return 'animateMotion';
2892+
case 'animatemotion':
2893+
return 'animateMotion';
28902894

2891-
case 'animatetransform':
2892-
return 'animateTransform';
2895+
case 'animatetransform':
2896+
return 'animateTransform';
28932897

2894-
case 'clippath':
2895-
return 'clipPath';
2898+
case 'clippath':
2899+
return 'clipPath';
28962900

2897-
case 'feblend':
2898-
return 'feBlend';
2901+
case 'feblend':
2902+
return 'feBlend';
28992903

2900-
case 'fecolormatrix':
2901-
return 'feColorMatrix';
2904+
case 'fecolormatrix':
2905+
return 'feColorMatrix';
29022906

2903-
case 'fecomponenttransfer':
2904-
return 'feComponentTransfer';
2907+
case 'fecomponenttransfer':
2908+
return 'feComponentTransfer';
29052909

2906-
case 'fecomposite':
2907-
return 'feComposite';
2910+
case 'fecomposite':
2911+
return 'feComposite';
29082912

2909-
case 'feconvolvematrix':
2910-
return 'feConvolveMatrix';
2913+
case 'feconvolvematrix':
2914+
return 'feConvolveMatrix';
29112915

2912-
case 'fediffuselighting':
2913-
return 'feDiffuseLighting';
2916+
case 'fediffuselighting':
2917+
return 'feDiffuseLighting';
29142918

2915-
case 'fedisplacementmap':
2916-
return 'feDisplacementMap';
2919+
case 'fedisplacementmap':
2920+
return 'feDisplacementMap';
29172921

2918-
case 'fedistantlight':
2919-
return 'feDistantLight';
2922+
case 'fedistantlight':
2923+
return 'feDistantLight';
29202924

2921-
case 'fedropshadow':
2922-
return 'feDropShadow';
2925+
case 'fedropshadow':
2926+
return 'feDropShadow';
29232927

2924-
case 'feflood':
2925-
return 'feFlood';
2928+
case 'feflood':
2929+
return 'feFlood';
29262930

2927-
case 'fefunca':
2928-
return 'feFuncA';
2931+
case 'fefunca':
2932+
return 'feFuncA';
29292933

2930-
case 'fefuncb':
2931-
return 'feFuncB';
2934+
case 'fefuncb':
2935+
return 'feFuncB';
29322936

2933-
case 'fefuncg':
2934-
return 'feFuncG';
2937+
case 'fefuncg':
2938+
return 'feFuncG';
29352939

2936-
case 'fefuncr':
2937-
return 'feFuncR';
2940+
case 'fefuncr':
2941+
return 'feFuncR';
29382942

2939-
case 'fegaussianblur':
2940-
return 'feGaussianBlur';
2943+
case 'fegaussianblur':
2944+
return 'feGaussianBlur';
29412945

2942-
case 'feimage':
2943-
return 'feImage';
2946+
case 'feimage':
2947+
return 'feImage';
29442948

2945-
case 'femerge':
2946-
return 'feMerge';
2949+
case 'femerge':
2950+
return 'feMerge';
29472951

2948-
case 'femergenode':
2949-
return 'feMergeNode';
2952+
case 'femergenode':
2953+
return 'feMergeNode';
29502954

2951-
case 'femorphology':
2952-
return 'feMorphology';
2955+
case 'femorphology':
2956+
return 'feMorphology';
29532957

2954-
case 'feoffset':
2955-
return 'feOffset';
2958+
case 'feoffset':
2959+
return 'feOffset';
29562960

2957-
case 'fepointlight':
2958-
return 'fePointLight';
2961+
case 'fepointlight':
2962+
return 'fePointLight';
29592963

2960-
case 'fespecularlighting':
2961-
return 'feSpecularLighting';
2964+
case 'fespecularlighting':
2965+
return 'feSpecularLighting';
29622966

2963-
case 'fespotlight':
2964-
return 'feSpotLight';
2967+
case 'fespotlight':
2968+
return 'feSpotLight';
29652969

2966-
case 'fetile':
2967-
return 'feTile';
2970+
case 'fetile':
2971+
return 'feTile';
29682972

2969-
case 'feturbulence':
2970-
return 'feTurbulence';
2973+
case 'feturbulence':
2974+
return 'feTurbulence';
29712975

2972-
case 'foreignobject':
2973-
return 'foreignObject';
2976+
case 'foreignobject':
2977+
return 'foreignObject';
29742978

2975-
case 'glyphref':
2976-
return 'glyphRef';
2977-
2978-
case 'lineargradient':
2979-
return 'linearGradient';
2979+
case 'glyphref':
2980+
return 'glyphRef';
29802981

2981-
case 'radialgradient':
2982-
return 'radialGradient';
2982+
case 'lineargradient':
2983+
return 'linearGradient';
29832984

2984-
case 'textpath':
2985-
return 'textPath';
2985+
case 'radialgradient':
2986+
return 'radialGradient';
29862987

2987-
default:
2988-
return $lower_tag_name;
2989-
}
2988+
case 'textpath':
2989+
return 'textPath';
29902990
}
29912991

2992-
// This unnecessary return prevents tools from inaccurately reporting type errors.
2993-
return $tag_name;
2992+
return $lower_tag_name;
29942993
}
29952994

29962995
/**

0 commit comments

Comments
 (0)