Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Zone.js replaces MutationObserver with an unnamed constructor #197

Closed
alan-knight opened this issue Oct 30, 2015 · 7 comments
Closed

Zone.js replaces MutationObserver with an unnamed constructor #197

alan-knight opened this issue Oct 30, 2015 · 7 comments

Comments

@alan-knight
Copy link

This is a problem with Dart 1.13 Dartium, which is relying on the constructor name to find the corresponding Dart class. This shows up if you try to run Dartium with the Polymer DevTools extension.
@justinfagnani

@btford
Copy link
Contributor

btford commented Oct 30, 2015

Sorry, maybe I'm missing something. Why run zone.js inside Dartium?

@alan-knight
Copy link
Author

The context where this arose is having the Polymer DevTools extension running. That replaces MutationObserver with an anonymous constructor, so when Dartium sees a JS MutationObserver it no longer knows what to do with it.

@ThiagoT1
Copy link

This behavior also breaks tinymce. MutationObserver.takeRecords() function calls will always throw, since the wrapper does not expose that function.

@ThiagoT1
Copy link

I added this on mutation-observer.ts and the errors went away:

          global[className].prototype.takeRecords = function () {
            if (!this[isActiveKey]) {
                this[creationZoneKey].enqueueTask();
                this[isActiveKey] = true;
            }
            return this[originalInstanceKey].takeRecords.apply(this[originalInstanceKey], arguments);
        };

@TheDVolk007
Copy link

@ThiagoT1 I have faced the same problem with tinymce recently, but I was unable to test your solution and I had to fix it in a dirtier way (inside tinymce). If your solution did good, may I ask you to pass it as pull-request, so it could present in next releases?

@ThiagoT1
Copy link

ThiagoT1 commented Mar 3, 2016

@TheDVolk007 It seems the major recent refactor on zone.js took care of that, as seen here:

https://github.com/angular/zone.js/blob/master/lib/browser/utils.ts#L218

I couldn't test it, though. My project is based on angular and it seems angular still depends on the "old" 0.5.15 API.

@JiaLiPassion
Copy link
Collaborator

Close for now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants