(In reply to Jonas Allmann [:jallmann] from comment #2)
I am not sure about the correctness of my changes for two reasons.
- In some cases I was not sure which object to attach the eventHandler to; the window, the document, or a specific button.
It's dispatched on the <dialog> element, so on document.documentElement. The event bubbles, so it doesn't really matter much where we attach the listener. document is fine, and you were consistent, which is the more important issue. So not worried about this part. :-)
- The current implementation of _fireButtonEvent evaluates the return value of the functions stored in the ondialogextra attributes. The only way I see to reproduce that behaviour with event handlers is to use "event.preventDefault()" to cause dispatchEvent() to return false. Is that a viable solution?
I think that sounds great. The thing I don't really understand is... afaict, we never use the return value for the extra1/extra2 buttons, right? I see us using it for accept/cancel, but not for anything else. We pass it back to
_doButtonCommand which (besides the accept/cancel cases) passes it some more, and then we pass it back to
_handleButtonCommand... but I don't see it actually mattering for the extra1/extra2 case whether or not we preventDefault(). Or am I missing something?