Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
dom.isVerticalEdge(element, false);
// $ExpectType void
dom.placeCaretAtHorizontalEdge(element, true);
// $ExpectType void
dom.placeCaretAtHorizontalEdge(undefined, false);
// $ExpectType void
dom.placeCaretAtVerticalEdge(element, true);
// $ExpectType void
dom.placeCaretAtVerticalEdge(undefined, false);
// $ExpectType void
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);
schema.hasOwnProperty( tag ) &&
( ! schema[ tag ].isMatch || schema[ tag ].isMatch( node ) )
) {
if ( node.nodeType === ELEMENT_NODE ) {
const {
attributes = [],
classes = [],
children,
require = [],
allowEmpty,
} = schema[ tag ];
// If the node is empty and it's supposed to have children,
// remove the node.
if ( children && ! allowEmpty && isEmpty( node ) ) {
remove( node );
return;
}
if ( node.hasAttributes() ) {
// Strip invalid attributes.
Array.from( node.attributes ).forEach( ( { name } ) => {
if ( name !== 'class' && ! includes( attributes, name ) ) {
node.removeAttribute( name );
}
} );
// Strip invalid classes.
// In jsdom-jscore, 'node.classList' can be undefined.
// TODO: Explore patching this in jsdom-jscore.
if ( node.classList && node.classList.length ) {
const mattchers = classes.map( ( item ) => {
} else if (
node.parentNode.nodeName === 'BODY' &&
isPhrasingContent( node )
) {
cleanNodeList( node.childNodes, doc, schema, inline );
if ( Array.from( node.childNodes ).some( ( child ) => ! isPhrasingContent( child ) ) ) {
unwrap( node );
}
} else {
cleanNodeList( node.childNodes, doc, children, inline );
}
// Remove children if the node is not supposed to have any.
} else {
while ( node.firstChild ) {
remove( node.firstChild );
}
}
}
}
// Invalid child. Continue with schema at the same place and unwrap.
} else {
cleanNodeList( node.childNodes, doc, schema, inline );
// For inline mode, insert a line break when unwrapping nodes that
// are not phrasing content.
if ( inline && ! isPhrasingContent( node ) && node.nextElementSibling ) {
insertAfter( doc.createElement( 'br' ), node );
}
unwrap( node );
}
const customText = node.nodeValue.slice( 4 ).trim();
/*
* When a `` comment is found, we need to look for any
* `` sibling, but it may not be a direct sibling
* (whitespace typically lies in between)
*/
let sibling = node;
let noTeaser = false;
while ( ( sibling = sibling.nextSibling ) ) {
if (
sibling.nodeType === COMMENT_NODE &&
sibling.nodeValue === 'noteaser'
) {
noTeaser = true;
remove( sibling );
break;
}
}
replace( node, createMore( customText, noTeaser, doc ) );
}
}
export default function( node ) {
if ( node.nodeName === 'IFRAME' ) {
remove( node );
}
}