Beispiel #1
0
 /**
  * Check if the given Element matches this selector's dynamic properties. Note: the parser should
  * give all class
  */
 public boolean matchesDynamic(Object e, AttributeResolver attRes, TreeResolver treeRes) {
   if (siblingSelector != null) {
     Object sib = siblingSelector.getAppropriateSibling(e, treeRes);
     if (sib == null) {
       return false;
     }
     if (!siblingSelector.matchesDynamic(sib, attRes, treeRes)) {
       return false;
     }
   }
   if (isPseudoClass(VISITED_PSEUDOCLASS)) {
     if (attRes == null || !attRes.isVisited(e)) {
       return false;
     }
   }
   if (isPseudoClass(ACTIVE_PSEUDOCLASS)) {
     if (attRes == null || !attRes.isActive(e)) {
       return false;
     }
   }
   if (isPseudoClass(HOVER_PSEUDOCLASS)) {
     if (attRes == null || !attRes.isHover(e)) {
       return false;
     }
   }
   if (isPseudoClass(FOCUS_PSEUDOCLASS)) {
     if (attRes == null || !attRes.isFocus(e)) {
       return false;
     }
   }
   return true;
 }
Beispiel #2
0
 public void setPos(int pos) {
   _pos = pos;
   if (siblingSelector != null) {
     siblingSelector.setPos(pos);
   }
   if (chainedSelector != null) {
     chainedSelector.setPos(pos);
   }
 }
Beispiel #3
0
 /**
  * returns "a number in a large base" with specificity and specification order of selector
  *
  * @return The order value
  */
 String getOrder() {
   if (chainedSelector != null) {
     return chainedSelector.getOrder();
   } // only "deepest" value is correct
   String b = "000" + getSpecificityB();
   String c = "000" + getSpecificityC();
   String d = "000" + getSpecificityD();
   String p = "00000" + _pos;
   return "0"
       + b.substring(b.length() - 3)
       + c.substring(c.length() - 3)
       + d.substring(d.length() - 3)
       + p.substring(p.length() - 5);
 }
Beispiel #4
0
 /** Check if the given Element matches this selector. Note: the parser should give all class */
 public boolean matches(Object e, AttributeResolver attRes, TreeResolver treeRes) {
   if (siblingSelector != null) {
     Object sib = siblingSelector.getAppropriateSibling(e, treeRes);
     if (sib == null) {
       return false;
     }
     if (!siblingSelector.matches(sib, attRes, treeRes)) {
       return false;
     }
   }
   if (_name == null || treeRes.matchesElement(e, _namespaceURI, _name)) {
     if (conditions != null) {
       // all conditions need to be true
       for (java.util.Iterator i = conditions.iterator(); i.hasNext(); ) {
         Condition c = (Condition) i.next();
         if (!c.matches(e, attRes, treeRes)) {
           return false;
         }
       }
     }
     return true;
   }
   return false;
 }
Beispiel #5
0
 public String getSelectorText() {
   return _text + (chainedSelector != null ? (" " + chainedSelector.getSelectorText()) : "");
 }