private Vector applyCSS(HTMLElement element,HTMLComponent htmlC,CSSElement[] css,Vector nestedSelectors,Vector siblingSelectors){
  String id=element.getAttributeById(HTMLElement.ATTR_ID);
  String className=element.getAttributeById(HTMLElement.ATTR_CLASS);
  Vector nextNestedSelectors=new Vector();
  Vector nextSiblingSelectors=null;
  if (!HTMLComponent.PROCESS_HTML_MP1_ONLY) {
    nextSiblingSelectors=new Vector();
  }
  for (int e=0; e < css.length; e++) {
    CSSElement currentSelector=css[e];
    checkSelector(currentSelector,element,htmlC,className,id,nextNestedSelectors,nextSiblingSelectors);
  }
  if (nestedSelectors != null) {
    for (Enumeration e=nestedSelectors.elements(); e.hasMoreElements(); ) {
      CSSElement currentSelector=(CSSElement)e.nextElement();
      checkSelector(currentSelector,element,htmlC,className,id,nextNestedSelectors,nextSiblingSelectors);
    }
  }
  if ((!HTMLComponent.PROCESS_HTML_MP1_ONLY) && (siblingSelectors != null)) {
    for (Enumeration e=siblingSelectors.elements(); e.hasMoreElements(); ) {
      CSSElement currentSelector=(CSSElement)e.nextElement();
      checkSelector(currentSelector,element,htmlC,className,id,nextNestedSelectors,nextSiblingSelectors);
    }
  }
  if (nextNestedSelectors.size() == 0) {
    nextNestedSelectors=null;
  }
  if ((!HTMLComponent.PROCESS_HTML_MP1_ONLY) && (nextSiblingSelectors.size() == 0)) {
    nextSiblingSelectors=null;
  }
  applyStyleAttribute(element,htmlC);
  Vector curSiblingSelectors=null;
  for (int i=0; i < element.getNumChildren(); i++) {
    HTMLElement child=(HTMLElement)element.getChildAt(i);
    Vector v=applyCSS(child,htmlC,css,nextNestedSelectors,curSiblingSelectors);
    if (!child.isTextElement()) {
      curSiblingSelectors=v;
    }
  }
  return nextSiblingSelectors;
}

private Vector applyCSS ( HTMLElement element , HTMLComponent htmlC , CSSElement [ ] css , Vector nestedSelectors , Vector siblingSelectors ) { String id = element . getAttributeById ( HTMLElement . ATTR_ID ) ; String className = element . getAttributeById ( HTMLElement . ATTR_CLASS ) ; Vector nextNestedSelectors = new Vector ( ) ; Vector nextSiblingSelectors = null ; if ( ! HTMLComponent . PROCESS_HTML_MP1_ONLY ) { nextSiblingSelectors = new Vector ( ) ; } for ( int e = 0 ; e < css . length ; e ++ ) { CSSElement currentSelector = css [ e ] ; checkSelector ( currentSelector , element , htmlC , className , id , nextNestedSelectors , nextSiblingSelectors ) ; } if ( nestedSelectors != null ) { for ( Enumeration e = nestedSelectors . elements ( ) ; e . hasMoreElements ( ) ; ) { CSSElement currentSelector = ( CSSElement ) e . nextElement ( ) ; checkSelector ( currentSelector , element , htmlC , className , id , nextNestedSelectors , nextSiblingSelectors ) ; } } if ( ( ! HTMLComponent . PROCESS_HTML_MP1_ONLY ) && ( siblingSelectors != null ) ) { for ( Enumeration e = siblingSelectors . elements ( ) ; e . hasMoreElements ( ) ; ) { CSSElement currentSelector = ( CSSElement ) e . nextElement ( ) ; checkSelector ( currentSelector , element , htmlC , className , id , nextNestedSelectors , nextSiblingSelectors ) ; } } if ( nextNestedSelectors . size ( ) == 0 ) { nextNestedSelectors = null ; } if ( ( ! HTMLComponent . PROCESS_HTML_MP1_ONLY ) && ( nextSiblingSelectors . size ( ) == 0 ) ) { nextSiblingSelectors = null ; } applyStyleAttribute ( element , htmlC ) ; Vector curSiblingSelectors = null ; for ( int i = 0 ; i < element . getNumChildren ( ) ; i ++ ) { HTMLElement child = ( HTMLElement ) element . getChildAt ( i ) ; Vector v = applyCSS ( child , htmlC , css , nextNestedSelectors , curSiblingSelectors ) ; if ( ! child . isTextElement ( ) ) { curSiblingSelectors = v ; } } return nextSiblingSelectors ; }
a recursive method that tries to match all css selectors with the specified element
