Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
dom.remove(node);
// $ExpectType void
dom.replace(node, node);
// $ExpectType HTMLParagraphElement
dom.replaceTag(node, 'p');
// $ExpectType HTMLSpanElement
dom.replaceTag(node, 'span');
// $ExpectType void
dom.unwrap(node);
// $ExpectType void
dom.wrap(node, node);
export default function( node, doc ) {
// In jsdom-jscore, 'node.style' can be null.
// TODO: Explore fixing this by patching jsdom-jscore.
if ( node.nodeName === 'SPAN' && node.style ) {
const {
fontWeight,
fontStyle,
textDecorationLine,
verticalAlign,
} = node.style;
if ( fontWeight === 'bold' || fontWeight === '700' ) {
wrap( doc.createElement( 'strong' ), node );
}
if ( fontStyle === 'italic' ) {
wrap( doc.createElement( 'em' ), node );
}
if ( textDecorationLine === 'line-through' ) {
wrap( doc.createElement( 's' ), node );
}
if ( verticalAlign === 'super' ) {
wrap( doc.createElement( 'sup' ), node );
} else if ( verticalAlign === 'sub' ) {
wrap( doc.createElement( 'sub' ), node );
}
} else if ( node.nodeName === 'B' ) {