}
});
}
private static Map<ElKey, EnumSet<EFlag>> elementFlags(HtmlSchema schema) {
final ElKey SCRIPT = ElKey.forHtmlElement("script");
final ElKey STYLE = ElKey.forHtmlElement("style");
Map<ElKey, EnumSet<EFlag>> elementFlags = Maps.newTreeMap();
for (ElKey elementName : schema.getElementNames()) {
HTML.Element el = schema.lookupElement(elementName);
EnumSet<EFlag> flags = EnumSet.noneOf(EFlag.class);
if (el.isEndTagOptional()) { flags.add(EFlag.OPTIONAL_ENDTAG); }
if (el.isEmpty()) { flags.add(EFlag.EMPTY); }
if (elementName.isHtml()) {
switch (HtmlTextEscapingMode.getModeForTag(elementName.localName)) {
case CDATA:
flags.add(EFlag.CDATA);
break;
case RCDATA:
flags.add(EFlag.RCDATA);
break;
default: break;
}
}
if (!schema.isElementAllowed(elementName)) {
flags.add(EFlag.UNSAFE);
if (SCRIPT.equals(elementName)) {
flags.add(EFlag.SCRIPT);
} else if (STYLE.equals(elementName)) {
flags.add(EFlag.STYLE);
}
}
if (HtmlSchema.isElementFoldable(elementName)) {
flags.add(EFlag.FOLDABLE);