use of org.asqatasun.rules.elementselector.SimpleElementSelector in project Asqatasun by Asqatasun.
the class Aw22Rule10012 method select.
@Override
protected void select(SSPHandler sspHandler) {
totalNumberOfElements = sspHandler.getTotalNumberOfElements();
// retrieve element from the nomenclature
Nomenclature deprecatedHtmlAttr = nomenclatureLoaderService.loadByCode(PRESENTATION_ATTR_NOM);
for (String deprecatedAttr : deprecatedHtmlAttr.getValueList()) {
SimpleElementSelector sec = new SimpleElementSelector(buildQuery(deprecatedAttr));
ElementHandler<Element> eh = new ElementHandlerImpl();
sec.selectElements(sspHandler, eh);
attrElementHandlerMap.put(deprecatedAttr, eh);
}
// elements with width attribute that are not img
SimpleElementSelector secWidthAttrNotImg = new SimpleElementSelector(ELEMENT_WITH_WITDH_ATTR_NOT_IMG);
ElementHandler<Element> ehWithAttrNotImg = new ElementHandlerImpl();
secWidthAttrNotImg.selectElements(sspHandler, ehWithAttrNotImg);
attrElementHandlerMap.put(WIDTH_ATTR, ehWithAttrNotImg);
// elements with width attribute that are not img
SimpleElementSelector secHeightAttrNotImg = new SimpleElementSelector(ELEMENT_WITH_HEIGHT_ATTR_NOT_IMG);
ElementHandler<Element> ehHeightAttrNotImg = new ElementHandlerImpl();
secHeightAttrNotImg.selectElements(sspHandler, ehHeightAttrNotImg);
attrElementHandlerMap.put(HEIGHT_ATTR, ehHeightAttrNotImg);
}
use of org.asqatasun.rules.elementselector.SimpleElementSelector in project Asqatasun by Asqatasun.
the class Aw22Rule08091 method select.
@Override
protected void select(SSPHandler sspHandler) {
// Selection of all links without target
ElementSelector linkWithoutTargetSelector = new SimpleElementSelector(LINK_WITHOUT_TARGET_CSS_LIKE_QUERY);
linkWithoutTargetSelector.selectElements(sspHandler, linkWithoutTarget);
// Selection of all links without target
ElementSelector fielsetNotWithinFormSelector = new SimpleElementSelector(FIELDSET_NOT_WITHIN_FORM_CSS_LIKE_QUERY);
fielsetNotWithinFormSelector.selectElements(sspHandler, fieldsetNotWithinForm);
totalNumberOfElements = sspHandler.getTotalNumberOfElements();
}
use of org.asqatasun.rules.elementselector.SimpleElementSelector in project Asqatasun by Asqatasun.
the class Rgaa22Rule07081 method select.
@Override
protected void select(SSPHandler sspHandler) {
super.select(sspHandler);
// retrieve element from the nomenclature
Nomenclature deprecatedHtmlTags = nomenclatureLoaderService.loadByCode(PRESENTATION_TAG_NOM);
// add each element of the nomenclature to the selector
MultipleElementSelector mes = new MultipleElementSelector();
for (String deprecatedTag : deprecatedHtmlTags.getValueList()) {
mes.addCssQuery(deprecatedTag.toLowerCase());
}
mes.selectElements(sspHandler, deprecatedElementHandler);
// retrieve element from the nomenclature
Nomenclature deprecatedHtmlAttr = nomenclatureLoaderService.loadByCode(PRESENTATION_ATTR_NOM);
for (String deprecatedAttr : deprecatedHtmlAttr.getValueList()) {
SimpleElementSelector sec = new SimpleElementSelector(buildQuery(deprecatedAttr));
ElementHandler eh = new ElementHandlerImpl();
sec.selectElements(sspHandler, eh);
attrElementHandlerMap.put(deprecatedAttr, eh);
}
}
use of org.asqatasun.rules.elementselector.SimpleElementSelector in project Asqatasun by Asqatasun.
the class Rgaa22Rule07091 method select.
@Override
protected void select(SSPHandler sspHandler) {
// Selection of all links without target
ElementSelector linkWithoutTargetSelector = new SimpleElementSelector(LINK_WITHOUT_TARGET_CSS_LIKE_QUERY);
linkWithoutTargetSelector.selectElements(sspHandler, linkWithoutTarget);
// Selection of all links without target
ElementSelector fielsetNotWithinFormSelector = new SimpleElementSelector(FIELDSET_NOT_WITHIN_FORM_CSS_LIKE_QUERY);
fielsetNotWithinFormSelector.selectElements(sspHandler, fieldsetNotWithinForm);
totalNumberOfElements = sspHandler.getTotalNumberOfElements();
}
use of org.asqatasun.rules.elementselector.SimpleElementSelector in project Asqatasun by Asqatasun.
the class SeoRule07051 method select.
@Override
protected void select(SSPHandler sspHandler) {
ElementSelector selector = new SimpleElementSelector(H1_ELEMENT);
selector.selectElements(sspHandler, h1Elements);
// only keep one title when more than 2 are encountered
selector = new SimpleElementSelector(TITLE_ELEMENT);
selector.selectElements(sspHandler, titleElement);
if (titleElement.get().size() > 1) {
Element title = titleElement.get().iterator().next();
titleElement.clean().add(title);
}
}
Aggregations