}
@SuppressWarnings("unchecked")
public <H extends EventHandler> HandlerRegistration addDomHandler(final H handler, final PDomEvent.Type<H> type) {
final Set<H> handlerSet = ensureDomHandler().getHandlerSet(type, this);
final HandlerRegistration handlerRegistration = domHandler.addHandlerToSource(type, this, handler);
if (handlerSet.isEmpty()) {
final AddHandler addHandler = new AddHandler(getID(), HANDLER.KEY_.DOM_HANDLER);
addHandler.put(PROPERTY.DOM_HANDLER_CODE, type.getDomHandlerType().ordinal());
if (handler instanceof JSONObject) {
try {