Package org.htmlcleaner.conditional
Class TagNodeEmptyContentCondition
- java.lang.Object
-
- org.htmlcleaner.conditional.TagNodeEmptyContentCondition
-
- All Implemented Interfaces:
ITagNodeCondition
public class TagNodeEmptyContentCondition extends java.lang.Object implements ITagNodeCondition
Checks if node is an inline 0r block element and has empty contents or white/non-breakable spaces only. Nodes that have non-empty id attribute are considered to be non-empty, since they can be used in javascript scenarios. Examples that should be pruned,
Examples of code that should NOT be pruned:
- no content but image tags do not have text content.hi - the first (empty) td is a placeholder so the second td is in the correct column-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
ID_ATTRIBUTE_NAME
private ITagInfoProvider
tagInfoProvider
private static java.util.Set<java.lang.String>
unsafeBlockElements
Removal of element from this set can affect layout too hard.
-
Constructor Summary
Constructors Constructor Description TagNodeEmptyContentCondition(ITagInfoProvider provider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
hasIdAttributeSet(TagNode tagNode)
boolean
satisfy(TagNode tagNode)
private boolean
satisfy(TagNode tagNode, boolean override)
-
-
-
Field Detail
-
ID_ATTRIBUTE_NAME
private static final java.lang.String ID_ATTRIBUTE_NAME
- See Also:
- Constant Field Values
-
unsafeBlockElements
private static final java.util.Set<java.lang.String> unsafeBlockElements
Removal of element from this set can affect layout too hard.
-
tagInfoProvider
private ITagInfoProvider tagInfoProvider
-
-
Constructor Detail
-
TagNodeEmptyContentCondition
public TagNodeEmptyContentCondition(ITagInfoProvider provider)
-
-
Method Detail
-
satisfy
public boolean satisfy(TagNode tagNode)
- Specified by:
satisfy
in interfaceITagNodeCondition
-
satisfy
private boolean satisfy(TagNode tagNode, boolean override)
-
hasIdAttributeSet
private boolean hasIdAttributeSet(TagNode tagNode)
-
-