code: public void removeElementScoped(TreeElement elem, RemoveInfo removes)
      {
          assert(elem != null);
  
          // check to see if we can exist without processing this element.  If the element
          // didn't define any attribute then we can.  This is inforced in the addElement method.
          ArrayList attrs = elem.getAttributeList();
          if (attrs == null || attrs.size() == 0)
              return;
  
          // walk all of the lists and each list looking for attributes that
          // are scoped only to the element
          for (int i = 0; i < _lists.length; i++) {
              ArrayList al = _lists[i];
              assert(al != null);
  
              int cnt = al.size();
              for (int j = 0; j < cnt; j++) {
                  TreeHtmlAttributeInfo attr = (TreeHtmlAttributeInfo) al.get(j);
                  assert(attr != null);
                  // Remove all of the attributes not scoped to the element itself.  We need to
                  // update the indexes because this removes the current item..
                  if (!attr.isApplyToDescendents()) {
                      al.remove(j);
                      cnt--;
                      j--;
                      if (removes != null && removes.scopeOverrides) {
                          TreeHtmlAttributeInfo addBack = checkScopeRemoval(i, attr, removes);
                          if (addBack != null) {
                              if (!al.contains(addBack))
                                  al.add(addBack);
                          }
                      }
                  }
              }
          }
      }
docs: This method will remove all of the elements scoped to the attribute.
  @param elem