docs: @Nonnull
    @ReturnsMutableCopy
    public static ICommonsList <IHCNode> getMergedInlineCSSAndJSNodes (@Nonnull final Iterable <? extends IHCNode> aNodes,
                                                                       @Nullable final IHCOnDocumentReadyProvider aOnDocumentReadyProvider)
    {
      ValueEnforcer.notNull (aNodes, "Nodes");
  
      // Apply all modifiers
      final Iterable <? extends IHCNode> aRealSpecialNodes = applyModifiers (aNodes);
  
      // Do standard aggregations of CSS and JS
      final ICommonsList <IHCNode> ret = new CommonsArrayList<> ();
      final CollectingJSCodeProvider aJSOnDocumentReadyBefore = new CollectingJSCodeProvider ();
      final CollectingJSCodeProvider aJSOnDocumentReadyAfter = new CollectingJSCodeProvider ();
      final CollectingJSCodeProvider aJSInlineBefore = new CollectingJSCodeProvider ();
      final CollectingJSCodeProvider aJSInlineAfter = new CollectingJSCodeProvider ();
      final InlineCSSList aCSSInlineBefore = new InlineCSSList ();
      final InlineCSSList aCSSInlineAfter = new InlineCSSList ();
      for (final IHCNode aNode : aRealSpecialNodes)
      {
        // Note: do not unwrap the node, because it is not allowed to merge JS/CSS
        // with a conditional comment with JS/CSS without a conditional comment!
  
        if (HCJSNodeDetector.isDirectJSInlineNode (aNode))
        {
          // Check HCScriptInlineOnDocumentReady first, because it is a subclass
          // of IHCScriptInline
          if (aNode instanceof HCScriptInlineOnDocumentReady)
          {
            // Inline JS
            final HCScriptInlineOnDocumentReady aScript = (HCScriptInlineOnDocumentReady) aNode;
            (aScript.isEmitAfterFiles () ? aJSOnDocumentReadyAfter
                                         : aJSOnDocumentReadyBefore).appendFlattened (aScript.getOnDocumentReadyCode ());
          }
          else
          {
            // Inline JS
            final IHCScriptInline <?> aScript = (IHCScriptInline <?>) aNode;
            (aScript.isEmitAfterFiles () ? aJSInlineAfter
                                         : aJSInlineBefore).appendFlattened (aScript.getJSCodeProvider ());
          }
        }
        else
          if (HCCSSNodeDetector.isDirectCSSInlineNode (aNode))
          {
            // Inline CSS
            final HCStyle aStyle = (HCStyle) aNode;
            (aStyle.isEmitAfterFiles () ? aCSSInlineAfter : aCSSInlineBefore).addInlineCSS (aStyle.getMedia (),
                                                                                            aStyle.getStyleContent ());
          }
          else
          {
            // HCLink
            // HCScriptFile
            // HCConditionalCommentNode
            if (!(aNode instanceof HCLink) &&
                !(aNode instanceof HCScriptFile) &&
                !(aNode instanceof IHCConditionalCommentNode))
              LOGGER.warn ("Found unexpected node to merge inline CSS/JS: " + aNode);
  
            // Add always!
            // These nodes are either file based nodes ot conditional comment
            // nodes
            ret.add (aNode);
          }
      }
  
      // on-document-ready JS always as last inline JS!
      if (!aJSOnDocumentReadyBefore.isEmpty ())
        if (aOnDocumentReadyProvider != null)
          aJSInlineBefore.append (aOnDocumentReadyProvider.createOnDocumentReady (aJSOnDocumentReadyBefore));
        else
          aJSInlineBefore.append (aJSOnDocumentReadyBefore);
  
      if (!aJSOnDocumentReadyAfter.isEmpty ())
        if (aOnDocumentReadyProvider != null)
          aJSInlineAfter.append (aOnDocumentReadyProvider.createOnDocumentReady (aJSOnDocumentReadyAfter));
        else
          aJSInlineAfter.append (aJSOnDocumentReadyAfter);
  
      // Finally add the inline JS
      if (!aJSInlineBefore.isEmpty ())
      {
        // Add at the beginning
        final HCScriptInline aScript = new HCScriptInline (aJSInlineBefore).setEmitAfterFiles (false);
        aScript.internalSetNodeState (EHCNodeState.RESOURCES_REGISTERED);
        ret.add (0, aScript);
      }
  
      if (!aJSInlineAfter.isEmpty ())
      {
        // Add at the end
        final HCScriptInline aScript = new HCScriptInline (aJSInlineAfter).setEmitAfterFiles (true);
        aScript.internalSetNodeState (EHCNodeState.RESOURCES_REGISTERED);
        ret.add (aScript);
      }
  
      // Add all merged inline CSSs grouped by their media list
      if (aCSSInlineBefore.isNotEmpty ())
      {
        // Add at the beginning
        int nIndex = 0;
        for (final ICSSCodeProvider aEntry : aCSSInlineBefore.getAll ())
        {
          final HCStyle aStyle = new HCStyle (aEntry.getCSSCode ()).setMedia (aEntry.getMediaList ())
                                                                   .setEmitAfterFiles (false);
          aStyle.internalSetNodeState (EHCNodeState.RESOURCES_REGISTERED);
          ret.add (nIndex, aStyle);
          ++nIndex;
        }
      }
  
      if (aCSSInlineAfter.isNotEmpty ())
      {
        // Add at the end
        for (final ICSSCodeProvider aEntry : aCSSInlineAfter.getAll ())
        {
          final HCStyle aStyle = new HCStyle (aEntry.getCSSCode ()).setMedia (aEntry.getMediaList ())
                                                                   .setEmitAfterFiles (true);
          aStyle.internalSetNodeState (EHCNodeState.RESOURCES_REGISTERED);
          ret.add (aStyle);
        }
      }
  
      return ret;
    }