client/components/tinymce/plugins/after-the-deadline/core.js
function bringTheHurt( node ) {
						let span, splitNodes;

						if ( node.nodeType === 3 ) {
							ecount++;

							/* sometimes IE likes to ignore the space between two spans, solution is to insert a placeholder span with
							   a non-breaking space.  The markup removal code substitutes this span for a space later */
							if (
								parent.isIE() &&
								node.nodeValue.length > 0 &&
								node.nodeValue.substr( 0, 1 ) === ' '
							) {
								return parent.create(
									emptySpan +
										node.nodeValue.substr( 1, node.nodeValue.length - 1 ).replace( regexp, result ),
									false
								);
							}

							if ( textOnlyMode ) {
								return parent.create( node.nodeValue.replace( regexp, result ), false );
							}

							span = parent.create( '<span />' );
							if ( typeof textOnlyMode === 'undefined' ) {
								// cache this to avoid adding / removing nodes unnecessarily
								textOnlyMode = typeof span.appendChild !== 'function';
								if ( textOnlyMode ) {
									parent.remove( span );
									return parent.create( node.nodeValue.replace( regexp, result ), false );
								}
							}

							// "Visual" mode
							splitNodes = splitTextNode( node, regexp, result );
							for ( i = 0; i < splitNodes.length; i++ ) {
								span.appendChild( splitNodes[ i ] );
							}

							node = span;
							return node;
						}

						contents = parent.contents( node );

						for ( y = 0; y < contents.length; y++ ) {
							if ( contents[ y ].nodeType === 3 && regexp.test( contents[ y ].nodeValue ) ) {
								if (
									parent.isIE() &&
									contents[ y ].nodeValue.length > 0 &&
									contents[ y ].nodeValue.substr( 0, 1 ) === ' '
								) {
									nnode = parent.create(
										emptySpan +
											contents[ y ].nodeValue
												.substr( 1, contents[ y ].nodeValue.length - 1 )
												.replace( regexp, result ),
										true
									);
								} else {
									nnode = parent.create( contents[ y ].nodeValue.replace( regexp, result ), true );
								}

								parent.replaceWith( contents[ y ], nnode );
								parent.removeParent( nnode );

								ecount++;

								return node; /* we did a replacement so we can call it quits, errors only get used once */
							}
						}

						return node;
					}
function bringTheHurt( node ) {
						let span, splitNodes;

						if ( node.nodeType === 3 ) {
							ecount++;

							/* sometimes IE likes to ignore the space between two spans, solution is to insert a placeholder span with
							   a non-breaking space.  The markup removal code substitutes this span for a space later */
							if (
								parent.isIE() &&
								node.nodeValue.length > 0 &&
								node.nodeValue.substr( 0, 1 ) === ' '
							) {
								return parent.create(
									emptySpan +
										node.nodeValue.substr( 1, node.nodeValue.length - 1 ).replace( regexp, result ),
									false
								);
							}

							if ( textOnlyMode ) {
								return parent.create( node.nodeValue.replace( regexp, result ), false );
							}

							span = parent.create( '<span />' );
							if ( typeof textOnlyMode === 'undefined' ) {
								// cache this to avoid adding / removing nodes unnecessarily
								textOnlyMode = typeof span.appendChild !== 'function';
								if ( textOnlyMode ) {
									parent.remove( span );
									return parent.create( node.nodeValue.replace( regexp, result ), false );
								}
							}

							// "Visual" mode
							splitNodes = splitTextNode( node, regexp, result );
							for ( i = 0; i < splitNodes.length; i++ ) {
								span.appendChild( splitNodes[ i ] );
							}

							node = span;
							return node;
						}

						contents = parent.contents( node );

						for ( y = 0; y < contents.length; y++ ) {
							if ( contents[ y ].nodeType === 3 && regexp.test( contents[ y ].nodeValue ) ) {
								if (
									parent.isIE() &&
									contents[ y ].nodeValue.length > 0 &&
									contents[ y ].nodeValue.substr( 0, 1 ) === ' '
								) {
									nnode = parent.create(
										emptySpan +
											contents[ y ].nodeValue
												.substr( 1, contents[ y ].nodeValue.length - 1 )
												.replace( regexp, result ),
										true
									);
								} else {
									nnode = parent.create( contents[ y ].nodeValue.replace( regexp, result ), true );
								}

								parent.replaceWith( contents[ y ], nnode );
								parent.removeParent( nnode );

								ecount++;

								return node; /* we did a replacement so we can call it quits, errors only get used once */
							}
						}

						return node;
					}
function bringTheHurt ( node ) { let span , splitNodes ; if ( node . nodeType === 3 ) { ecount ++ ; /* sometimes IE likes to ignore the space between two spans, solution is to insert a placeholder span with
							   a non-breaking space.  The markup removal code substitutes this span for a space later */ if ( parent . isIE ( ) && node . nodeValue . length > 0 && node . nodeValue . substr ( 0 , 1 ) === ' ' ) { return parent . create ( emptySpan + node . nodeValue . substr ( 1 , node . nodeValue . length - 1 ) . replace ( regexp , result ) , false ) ; } if ( textOnlyMode ) { return parent . create ( node . nodeValue . replace ( regexp , result ) , false ) ; } span = parent . create ( '<span />' ) ; if ( typeof textOnlyMode === 'undefined' ) { // cache this to avoid adding / removing nodes unnecessarily textOnlyMode = typeof span . appendChild !== 'function' ; if ( textOnlyMode ) { parent . remove ( span ) ; return parent . create ( node . nodeValue . replace ( regexp , result ) , false ) ; } } // "Visual" mode splitNodes = splitTextNode ( node , regexp , result ) ; for ( i = 0 ; i < splitNodes . length ; i ++ ) { span . appendChild ( splitNodes [ i ] ) ; } node = span ; return node ; } contents = parent . contents ( node ) ; for ( y = 0 ; y < contents . length ; y ++ ) { if ( contents [ y ] . nodeType === 3 && regexp . test ( contents [ y ] . nodeValue ) ) { if ( parent . isIE ( ) && contents [ y ] . nodeValue . length > 0 && contents [ y ] . nodeValue . substr ( 0 , 1 ) === ' ' ) { nnode = parent . create ( emptySpan + contents [ y ] . nodeValue . substr ( 1 , contents [ y ] . nodeValue . length - 1 ) . replace ( regexp , result ) , true ) ; } else { nnode = parent . create ( contents [ y ] . nodeValue . replace ( regexp , result ) , true ) ; } parent . replaceWith ( contents [ y ] , nnode ) ; parent . removeParent ( nnode ) ; ecount ++ ; return node ; /* we did a replacement so we can call it quits, errors only get used once */ } } return node ; }
/* it's assumed that this function is only being called on text nodes (nodeType == 3), the iterating is necessary
because eventually the whole thing gets wrapped in an mceItemHidden span and from there it's necessary to
handle each node individually.
/ * it s assumed that this function is only being called on text nodes ( nodeType == 3 ) the iterating is necessary because eventually the whole thing gets wrapped in an mceItemHidden span and from there it s necessary to handle each node individually .