updateHandler function
Updates the handler wrapper for key on element with a new attr.
Called by _patchAttributes in diff.dart whenever a DOM node is reused
at the same position. The JS listener stays registered — only the Dart
callback it delegates to is updated.
Implementation
void updateHandler(Element element, String key, EventAttribute attr) {
final map = _handlers[element];
if (map != null && map.containsKey(key)) {
map[key]!.attr = attr;
} else {
// Not yet registered — first time this event appears on this node.
_registerHandler(element, key, attr);
}
}