docs: public final void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, ELException
      {
          // make sure our parent is not null
          if (parent == null)
          {
              throw new TagException(this.tag, "Parent UIComponent was null");
          }
  
          // possible facet scoped
          String facetName = this.getFacetName(ctx, parent);
  
          // our id
          String id = ctx.generateUniqueId(this.tagId);
  
          // grab our component
          UIComponent c = ComponentSupport.findChildByTagId(parent, id);
          boolean componentFound = false;
          if (c != null)
          {
              componentFound = true;
              // mark all children for cleaning
              if (log.isLoggable(Level.FINE))
              {
                  log.fine(this.tag + " Component[" + id + "] Found, marking children for cleanup");
              }
              ComponentSupport.markForDeletion(c);
          }
          else
          {
              c = this.createComponent(ctx);
              if (log.isLoggable(Level.FINE))
              {
                  log.fine(this.tag + " Component[" + id + "] Created: " + c.getClass().getName());
              }
              this.setAttributes(ctx, c);
  
              // mark it owned by a facelet instance
              c.getAttributes().put(ComponentSupport.MARK_CREATED, id);
  
              // assign our unique id
              if (this.id != null)
              {
                  c.setId(this.id.getValue(ctx));
              }
              else
              {
                  UIViewRoot root = ComponentSupport.getViewRoot(ctx, parent);
                  if (root != null)
                  {
                      String uid = root.createUniqueId();
                      c.setId(uid);
                  }
              }
  
              if (this.rendererType != null)
              {
                  c.setRendererType(this.rendererType);
              }
  
              // hook method
              this.onComponentCreated(ctx, c, parent);
          }
  
          // first allow c to get populated
          this.applyNextHandler(ctx, c);
  
          // finish cleaning up orphaned children
          if (componentFound)
          {
              ComponentSupport.finalizeForDeletion(c);
  
              if (facetName == null)
              {
                  parent.getChildren().remove(c);
              }
          }
  
          this.onComponentPopulated(ctx, c, parent);
  
          // add to the tree afterwards
          // this allows children to determine if it's
          // been part of the tree or not yet
          if (facetName == null)
          {
              parent.getChildren().add(c);
          }
          else
          {
              parent.getFacets().put(facetName, c);
          }
      }