RichText/Archived/Rooster/Rooster.gcomp/Support/node_modules/roosterjs/dist/rooster-amd.js
/**
 * If the specified element is a Word List comments, this code verifies and fixes
 * the markup when needed to ensure that Chrome bullet conversions work as expected
 * -----
 * We'll convert &lt;!--[if !supportLists]--&gt; and &lt;!--[endif]--&gt; comments into
 * &lt;span style="mso-list:Ignore"&gt;&lt;/span&gt;... Chrome has a bug where it drops the
 * styles of the span, but we'll use these comments to recreate them out
 */
If the specified element is a Word List comments, this code verifies and fixes
the markup when needed to ensure that Chrome bullet conversions work as expected


If the specified element is a Word List comments this code verifies and fixes the markup when needed to ensure that Chrome bullet conversions work as expected
function fixWordListComments(child, removeComments) {
    if (child.nodeType == 8 ) {
        var value = child.data;
        if (value && value.trim().toLowerCase() == '[if !supportlists]') {
            var nextElement = child;
            var endComment = null;
            for (var j = 0; j < 4; j++) {
                nextElement = getRealNextSibling(nextElement);
                if (!nextElement) {
                    break;
                }
                if (nextElement.nodeType == 8 ) {
                    value = nextElement.data;
                    if (value && value.trim().toLowerCase() == '[endif]') {
                        endComment = nextElement;
                        break;
                    }
                }
            }
            if (endComment) {
                var newSpan = child.ownerDocument.createElement('span');
                newSpan.setAttribute('style', 'mso-list: ignore');
                nextElement = getRealNextSibling(child);
                while (nextElement != endComment) {
                    nextElement = nextElement.nextSibling;
                    newSpan.appendChild(nextElement.previousSibling);
                }
                endComment.parentNode.insertBefore(newSpan, endComment);
                if (removeComments) {
                    child.parentNode.removeChild(child);
                    endComment.parentNode.removeChild(endComment);
                }
                child = newSpan;
            }
        }
    }
    return child;
}
function fixWordListComments ( child , removeComments ) { if ( child . nodeType == 8 ) { var value = child . data ; if ( value && value . trim ( ) . toLowerCase ( ) == '[if !supportlists]' ) { var nextElement = child ; var endComment = null ; for ( var j = 0 ; j < 4 ; j ++ ) { nextElement = getRealNextSibling ( nextElement ) ; if ( ! nextElement ) { break ; } if ( nextElement . nodeType == 8 ) { value = nextElement . data ; if ( value && value . trim ( ) . toLowerCase ( ) == '[endif]' ) { endComment = nextElement ; break ; } } } if ( endComment ) { var newSpan = child . ownerDocument . createElement ( 'span' ) ; newSpan . setAttribute ( 'style' , 'mso-list: ignore' ) ; nextElement = getRealNextSibling ( child ) ; while ( nextElement != endComment ) { nextElement = nextElement . nextSibling ; newSpan . appendChild ( nextElement . previousSibling ) ; } endComment . parentNode . insertBefore ( newSpan , endComment ) ; if ( removeComments ) { child . parentNode . removeChild ( child ) ; endComment . parentNode . removeChild ( endComment ) ; } child = newSpan ; } } } return child ; }
If the specified element is a Word List comments, this code verifies and fixes
 the markup when needed to ensure that Chrome bullet conversions work as expected
If the specified element is a Word List comments this code verifies and fixes the markup when needed to ensure that Chrome bullet conversions work as expected
/* Comment */ // We have a list ignore start, find the end.. We know is not more than // 3 nodes away, so we'll optimize our checks /* Comment */ // if we found the end node, wrap everything out // Insert the element out and use that one as the current child // Remove the comments out if the call specified it out // Last, make sure we return the new element out instead of the comment