newFromTagHandler( DOMCompat::nodeName( $node ) . '_' . ( $dp->stx ?? null ) ); // Unless a specialized handler is available, use the HTML handler // for html-stx tags. But, tags should never serialize as HTML. if ( !$handler && ( $dp->stx ?? null ) === 'html' && DOMCompat::nodeName( $node ) !== 'a' ) { return new FallbackHTMLHandler(); } // If in a HTML table tag, serialize table tags in the table // using HTML tags, instead of native wikitext tags. if ( isset( Consts::$HTML['ChildTableTags'][DOMCompat::nodeName( $node )] ) && !isset( Consts::$ZeroWidthWikitextTags[DOMCompat::nodeName( $node )] ) && WTUtils::inHTMLTableTag( $node ) ) { return new FallbackHTMLHandler(); } // If parent node is a list in html-syntax, then serialize // list content in html-syntax rather than wiki-syntax. if ( DOMUtils::isListItem( $node ) && DOMUtils::isList( $node->parentNode ) && WTUtils::isLiteralHTMLNode( $node->parentNode ) ) { return new FallbackHTMLHandler(); } // Pick the best available handler return $handler ?: $this->newFromTagHandler( DOMCompat::nodeName( $node ) ) ?: new FallbackHTMLHandler(); } }