for (Attr a : Nodes.attributesOf(el)) {
if (!scriptsPerNode.containsKey(a)) { continue; }
AttribKey attrKey = AttribKey.forAttribute(elKey, a);
// Keep track of whether there is an ID so that we know whether or
// not to remove any auto-generated ID later.
Expression dynamicValue = (Expression) scriptsPerNode.get(a);
if (ID.ns.uri != attrKey.ns.uri
|| !ID.localName.equals(attrKey.localName)) {
if (dynamicValue == null
|| dynamicValue instanceof StringLiteral) {
emitStaticAttr(a, (StringLiteral) dynamicValue, safe);
} else {
dynId = makeDynamicId(dynId, pos, bone.source);
String handlerName = dynamicValue.getAttributes().get(
HtmlAttributeRewriter.HANDLER_NAME);
if (handlerName != null
&& handlers.containsKey(handlerName)
&& handlersUsedInModule.add(handlerName)) {
emitHandler(handlerName);
}
emitDynamicAttr(a, dynamicValue, bone.source);
}
} else {
// A previous HTML parsing step should have ensured that each element
// only has one instance of each attribute.
assert id == null;
id = a;
}
}
// Output an ID
if (id != null) {
Expression dynamicValue = (Expression) scriptsPerNode.get(id);
if (dynId == null
&& (dynamicValue == null
|| dynamicValue instanceof StringLiteral)) {
emitStaticAttr(id, (StringLiteral) dynamicValue, safe);
} else {