newFromTagHandler( $node->nodeName . '_' . ( $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' && $node->nodeName !== '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( WikitextConstants::$HTML['ChildTableTags'][$node->nodeName] ) && !isset( WikitextConstants::$ZeroWidthWikitextTags[$node->nodeName] ) && 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( $node->nodeName ) ?: new FallbackHTMLHandler(); } }