else if (atts.isDefined(HTML.Attribute.CLASS))
if (atts.isDefined(HTML.Attribute.CLASS))
  public Style getRule(HTML.Tag t, Element e)  {    // Create list of the element and all of its parents, starting    // with the bottommost element.    ArrayList path = new ArrayList();    Element el;    AttributeSet atts;    for (el = e; el != null; el = el.getParentElement())      path.add(el);    // Create fully qualified selector.    StringBuilder selector = new StringBuilder();    int count = path.size();    // We append the actual element after this loop.    for (int i = count - 1; i > 0; i--)      {        el = (Element) path.get(i);        atts = el.getAttributes();        Object name = atts.getAttribute(StyleConstants.NameAttribute);        selector.append(name.toString());        if (atts.isDefined(HTML.Attribute.ID))          {            selector.append('#');            selector.append(atts.getAttribute(HTML.Attribute.ID));          }        else if (atts.isDefined(HTML.Attribute.CLASS))          {            selector.append('.');            selector.append(atts.getAttribute(HTML.Attribute.CLASS));          }        selector.append(' ');      }    selector.append(t.toString());    el = (Element) path.get(0);    atts = el.getAttributes();    // For leaf elements, we have to fetch the tag specific attributes.    if (el.isLeaf())      {        Object o = atts.getAttribute(t);        if (o instanceof AttributeSet)          atts = (AttributeSet) o;        else          atts = null;      }    if (atts != null)      {        if (atts.isDefined(HTML.Attribute.ID))          {            selector.append('#');            selector.append(atts.getAttribute(HTML.Attribute.ID));          }        else if (atts.isDefined(HTML.Attribute.CLASS))          {            selector.append('.');            selector.append(atts.getAttribute(HTML.Attribute.CLASS));          }      }    return getResolvedStyle(selector.toString(), path, t);  }