@@ -2979,22 +2979,37 @@ public function get_qualified_tag_name(): ?string {
29792979 *
29802980 * @since 6.7.0
29812981 *
2982- * @param string $attribute_name Which attribute to adjust.
2983- * @return string|null
2982+ * @param string $attribute_name Which attribute name to adjust.
2983+ *
2984+ * @return string|null The qualified attribute name or null if not on matched tag.
29842985 */
29852986 public function get_qualified_attribute_name ( $ attribute_name ): ?string {
29862987 if ( self ::STATE_MATCHED_TAG !== $ this ->parser_state ) {
29872988 return null ;
29882989 }
2990+ $ namespace = $ this ->get_namespace ();
2991+ return self ::lookup_qualified_attribute_name ( $ namespace , $ attribute_name );
2992+ }
29892993
2990- $ namespace = $ namespace_override ?? $ this ->get_namespace ();
2994+ /**
2995+ * Returns the adjusted attribute name for a given attribute, taking into
2996+ * account the provided namespace.
2997+ *
2998+ * @since 6.8.0
2999+ *
3000+ * @param string $ns The namespace to use: 'html', 'svg', or 'math'.
3001+ * @param string $attribute_name Which attribute to adjust.
3002+ *
3003+ * @return string The qualified attribute name.
3004+ */
3005+ final protected static function lookup_qualified_attribute_name ( string $ ns , string $ attribute_name ): string {
29913006 $ lower_name = strtolower ( $ attribute_name );
29923007
2993- if ( 'math ' === $ namespace && 'definitionurl ' === $ lower_name ) {
3008+ if ( 'math ' === $ ns && 'definitionurl ' === $ lower_name ) {
29943009 return 'definitionURL ' ;
29953010 }
29963011
2997- if ( 'svg ' === $ this -> get_namespace () ) {
3012+ if ( 'svg ' === $ ns ) {
29983013 switch ( $ lower_name ) {
29993014 case 'attributename ' :
30003015 return 'attributeName ' ;
@@ -3172,7 +3187,7 @@ public function get_qualified_attribute_name( $attribute_name ): ?string {
31723187 }
31733188 }
31743189
3175- if ( 'html ' !== $ namespace ) {
3190+ if ( 'html ' !== $ ns ) {
31763191 switch ( $ lower_name ) {
31773192 case 'xlink:actuate ' :
31783193 return 'xlink actuate ' ;
0 commit comments