tst/www/js/@index.js
function fixContainer ( container ) {
    var children = container.childNodes,
        doc = container.ownerDocument,
        wrapper = null,
        i, l, child, isBR,
        config = getSquireInstance( doc )._config;

    for ( i = 0, l = children.length; i < l; i += 1 ) {
        child = children[i];
        isBR = child.nodeName === 'BR';
        if ( !isBR && isInline( child ) ) {
            if ( !wrapper ) {
                 wrapper = createElement( doc,
                    config.blockTag, config.blockAttributes );
            }
            wrapper.appendChild( child );
            i -= 1;
            l -= 1;
        } else if ( isBR || wrapper ) {
            if ( !wrapper ) {
                wrapper = createElement( doc,
                    config.blockTag, config.blockAttributes );
            }
            fixCursor( wrapper );
            if ( isBR ) {
                container.replaceChild( wrapper, child );
            } else {
                container.insertBefore( wrapper, child );
                i += 1;
                l += 1;
            }
            wrapper = null;
        }
        if ( isContainer( child ) ) {
            fixContainer( child );
        }
    }
    if ( wrapper ) {
        container.appendChild( fixCursor( wrapper ) );
    }
    return container;
}
function fixContainer ( container ) {
    var children = container.childNodes,
        doc = container.ownerDocument,
        wrapper = null,
        i, l, child, isBR,
        config = getSquireInstance( doc )._config;

    for ( i = 0, l = children.length; i < l; i += 1 ) {
        child = children[i];
        isBR = child.nodeName === 'BR';
        if ( !isBR && isInline( child ) ) {
            if ( !wrapper ) {
                 wrapper = createElement( doc,
                    config.blockTag, config.blockAttributes );
            }
            wrapper.appendChild( child );
            i -= 1;
            l -= 1;
        } else if ( isBR || wrapper ) {
            if ( !wrapper ) {
                wrapper = createElement( doc,
                    config.blockTag, config.blockAttributes );
            }
            fixCursor( wrapper );
            if ( isBR ) {
                container.replaceChild( wrapper, child );
            } else {
                container.insertBefore( wrapper, child );
                i += 1;
                l += 1;
            }
            wrapper = null;
        }
        if ( isContainer( child ) ) {
            fixContainer( child );
        }
    }
    if ( wrapper ) {
        container.appendChild( fixCursor( wrapper ) );
    }
    return container;
}
function fixContainer ( container ) { var children = container . childNodes , doc = container . ownerDocument , wrapper = null , i , l , child , isBR , config = getSquireInstance ( doc ) . _config ; for ( i = 0 , l = children . length ; i < l ; i += 1 ) { child = children [ i ] ; isBR = child . nodeName === 'BR' ; if ( ! isBR && isInline ( child ) ) { if ( ! wrapper ) { wrapper = createElement ( doc , config . blockTag , config . blockAttributes ) ; } wrapper . appendChild ( child ) ; i -= 1 ; l -= 1 ; } else if ( isBR || wrapper ) { if ( ! wrapper ) { wrapper = createElement ( doc , config . blockTag , config . blockAttributes ) ; } fixCursor ( wrapper ) ; if ( isBR ) { container . replaceChild ( wrapper , child ) ; } else { container . insertBefore ( wrapper , child ) ; i += 1 ; l += 1 ; } wrapper = null ; } if ( isContainer ( child ) ) { fixContainer ( child ) ; } } if ( wrapper ) { container . appendChild ( fixCursor ( wrapper ) ) ; } return container ; }
Recursively examine container nodes and wrap any inline children.
Recursively examine container nodes and wrap any inline children .