public void moveScriptElementsToBody ( ) { // Move all JS from head to body final ICommonsList < IHCNode > aJSNodes = new CommonsArrayList <> ( ) ; m_aHead . getAllAndRemoveAllJSNodes ( aJSNodes ) ; // Find index of first script in body int nFirstScriptIndex = 0 ; if ( m_aBody . hasChildren ( ) ) for ( final IHCNode aChild : m_aBody . getAllChildren ( ) ) { if ( aChild instanceof IHCScript < ? > ) { // Check if this is a special inline script to be emitted before files final boolean bIsInlineBeforeFiles = ( aChild instanceof IHCScriptInline < ? > ) && ! ( ( IHCScriptInline < ? > ) aChild ) . isEmitAfterFiles ( ) ; if ( ! bIsInlineBeforeFiles ) { // Remember index to insert before break ; } } nFirstScriptIndex ++ ; } m_aBody . addChildrenAt ( nFirstScriptIndex , aJSNodes ) ; }
Move all JS nodes from the head to the body .