code: @SuppressWarnings("unchecked")
      private void removeFormerFacets(UIComponent component)
      {
          List<String> formerFacetNames = (List<String>)component.getAttributes().get(FORMER_FACET_NAMES_SET_ATTR);
          if (formerFacetNames != null)
          {
              for (String facetName : formerFacetNames)
              {
                  if (_facetsAdded == null || !_facetsAdded.contains(facetName))
                  {
                      component.getFacets().remove(facetName);
                  }
              }
              if (_facetsAdded == null)
              {
                  component.getAttributes().remove(FORMER_FACET_NAMES_SET_ATTR);
              }
              else
              {
                  component.getAttributes().put(FORMER_FACET_NAMES_SET_ATTR, _facetsAdded);
              }
          }
          else
          {
              if (_facetsAdded != null)
              {
                  component.getAttributes().put(FORMER_FACET_NAMES_SET_ATTR, _facetsAdded);
              }
          }
      }
docs: See removeFormerChildren.