code: private void removeResource(FacesContext context, UIComponent resource, UIViewRoot view) {
          view.removeComponentResource(context, resource, HEAD);
          view.removeComponentResource(context, resource, TARGET);
      }
docs: Remove resource from head and target.