|
Class contains information about single HTML tag.
It also contains rules to for tag balancing. For each tag, list of dependant
tags may be defined. In order to more easely describe those rules, several
prefixed are introduced.
For each tag, list of dependant tags may be specified using following prefixes:
-
! fatal tag - required outer tag - the tag will be ignored during
parsing (will be skipped) if this fatal tag is missing. For example, most web
browsers ignore elements TD, TR, TBODY if they are not in the context of TABLE tag.
-
+ required enclosing tag - if there is no such, it is implicitely
created. For example if TD is out of TR - open TR is created before.
-
- permitted tag - it is not allowed to occure inside - for example
FORM cannot be inside other FORM and it will be ignored during cleanup.
-
# allowed children tags - for example TR allowes TD and TH. If there
are some dependant allowed tags defined then cleaner ignores other tags, treating
them as unallowed, unless they are in some other relationship with this tag.
-
^ higher level tags - for example for TR higher tags are THEAD, TBODY, TFOOT.
-
& tags that must be closed and copied - for example, in
<a href="#"><div>.... tag A must be closed before DIV but
copied again inside DIV.
Tag TR for instance (table row) may define the following dependancies:
!table,+tbody,^thead,^tfoot,#td,#th,tr,caption,colgroup
meaning the following:
TR must be in context of TABLE, otherwise it will be ignored,
TR may can be directly inside TBODY, TFOOT and THEAD, otherwise TBODY will be
implicitely created in front of it.
TR can contain TD and TD, all other tags and content will be pushed out of current
limiting context, in the case of html tables, in front of enclosing TABLE tag.
if previous open tag is one of TR, CAPTION or COLGROUP, it will be implicitely closed.
Created by Vladimir Nikic.
Date: November, 2006
|