> On Feb 26, 2016, at 3:22 PM, Elliott Sprehn <espr...@chromium.org> wrote: > > > > On Fri, Feb 26, 2016 at 3:09 PM, Ryosuke Niwa <rn...@apple.com> wrote: >> >> > On Feb 24, 2016, at 9:06 PM, Elliott Sprehn <espr...@chromium.org> wrote: >> > >> > Can you give a code example of how this happens? >> >> For example, execCommand('Delete') would result in sequentially deleting >> nodes as needed. >> During this compound operation, unload events may fire on iframes that got >> deleted by this operation. >> >> I would like components to be notified that they got removed/disconnected >> from the document >> before such an event is getting fired. >> > > I'd rather not do that, all the sync script inside editing operations is a > bug, and you shouldn't depend on the state of the world around you in there > anyway since all browsers disagree (ex. not all of them fire the event sync).
I don't think that's a bug given Safari, Chrome, and Gecko all fires unload event before finishing the delete operation. It's an interoperable behavior, which should be spec'ed. Anyway, this was just an easy example I could come up with. There are many other examples that involve DOM mutation events if you'd prefer seeing those instead. The fact of matter is that we don't live in the future, and it's better for API to be consistent in this imperfect world than for it to have weird edge cases. As a matter of fact, if you end up being able to kill those sync events in the future, this will become non-issue since end-of-nano-task as you (Google) proposed will happen before dispatching of any event. As things stand, however, we should dispatch lifecycle callbacks before dispatching these (legacy but compat mandating) events. - R. Niwa