GoogleChrome / dialog-polyfill

Polyfill for the HTML dialog element
BSD 3-Clause "New" or "Revised" License
2.45k stars 245 forks source link

Firefox, Mutation Events #103

Closed leifoolsen closed 7 years ago

leifoolsen commented 8 years ago

When I use dialog polyfill in Firefox version 45.0.1, OSX I get the following warning in console: "Use of Mutation Events is deprecated. Use MutationObserver instead.". Shouldn't the polyfill use MutationObserver if provided by the browser?

samthor commented 8 years ago

We still use the DOMNodeRemoved as it's difficult to observe oneself's removal with MutationObserver (you can only specify childList). This makes sure that if a modal dialog that's open is removed from the page, we properly unblock the page.

The alternative is to use a MutationObserver for the whole page but there's different overhead there.

samthor commented 8 years ago

When FF and other browsers properly deprecate this event, hopefully there'll be a better solution.

leifoolsen commented 8 years ago

@samthor: Thank you for reply. The dialog polyfill works great in browsers I have tested, and I have no problem with the warnings from FF. Regards Leif Olsen

Yaffle commented 8 years ago

@samthor , but the current code attaches the DOMNodeRemoved listener to the document, MutationObserver can be used the same way too, not?

samthor commented 8 years ago

@Yaffle you're right, thanks. I'll re-open this bug, I thought the code used it directly on the node.

Yaffle commented 8 years ago

@samthor thanks for reply