private boolean nodeSelectorMatches(final Selector s, final Node n) { if (n.getNodeType() == Node.ELEMENT_NODE) { final Element e = (Element) n; final MatchCondition matchCond = this.getMatchCondition(); return matchCond == null ? s.matches(e) : s.matches(e, matchCond); } else { return false; } }
/** * Computes the style of an element with an eventual pseudo element for the given media. * @param el The DOM element. * @param pseudo A pseudo element that should be used for style computation or <code>null</code> if no pseudo element should be used (e.g. :after). * @param media Used media specification. * @return The relevant declarations from the registered style sheets. */ public NodeData getElementStyle(Element el, PseudoDeclaration pseudo, MediaSpec media) { final OrderedRule[] applicableRules = AnalyzerUtil.getApplicableRules(sheets, el, media); return AnalyzerUtil.getElementStyle(el, pseudo, getElementMatcher(), getMatchCondition(), applicableRules); }
/** * Computes the style of an element with an eventual pseudo element for the given media. * @param el The DOM element. * @param pseudo A pseudo element that should be used for style computation or <code>null</code> if no pseudo element should be used (e.g. :after). * @param media Used media specification. * @return The relevant declarations from the registered style sheets. */ public NodeData getElementStyle(Element el, PseudoElementType pseudo, MediaSpec media) { final OrderedRule[] applicableRules = AnalyzerUtil.getApplicableRules(sheets, el, media); return AnalyzerUtil.getElementStyle(el, pseudo, getElementMatcher(), getMatchCondition(), applicableRules); }