-
Notifications
You must be signed in to change notification settings - Fork 492
'WeakMap' is undefined #210
Comments
Can you provide details about what build (full or -lite) and browser you are experiencing this issue with? |
It is the lite build on IE9, but will probably have the same issue on IE10. The revision I added in the first comment may not be the problem. I think the problem actually started in this one a49aaee |
We don't officially support IE9, per the browser compatibility matrix in the README. Are you able to repro this issue in IE10? |
The problem is reproducible on IE10 too. |
I'm seeing this problem as well, but only when running mocha tests via phantomJS. Simply including |
Same here, in Safari 7 on iOs 7 |
build-lite.json pulls in MutationObserver (which uses WeakMap) before it pulls in HTMLImport (which defines WeakMap on browsers that lack it.) The prebuilt webcomponents-lite.js version 0.5.5 (available through a link on the homepage https://github.com/webcomponents/webcomponentsjs/archive/0.5.5.zip ), as a result of this build order, has this problem of using WeakMap at line 55 before defining it starting at line 353. This commit seems to have caused this breaking change: However, if MutationObserver now really does need to be ahead of HTMLImport, then perhaps we need WeakMap pulled in as part of build-lite.json and have HTMLImport stop pulling it in? https://github.com/webcomponents/webcomponentsjs/blob/master/src/WebComponents/build-lite.json |
Since HTMLImports/build.json and CustomElements/build.json are both including their "../WeakMap/WeakMap.js" dependency, why don't you move the "../MutationObserver/MutationObserver.js" dependency into each of those and out of build-lite.json? Of course, it will need to go after "../WeakMap/WeakMap.js". |
I just noticed that ShadowDOM has its own MutationObserver.js polyfill (used by the non-lite webcomponents), so the "../MutationObserver/MutationObserver.js" dependency should not move into the common HTMLImports/build.json and CustomElements/build.json files. I tested adding the "../WeakMap/WeakMap.js" dependency directly into src/WebComponents/build-lite.json, right before "../MutationObserver/MutationObserver.js", and it correctly doesn't affect anything else except for fixing this issue by moving the WeakMap polyfill code before the dependent MutationObserver polyfill code. This is a simple change, but if you'd like, I could create a pull request for it. src/WebComponents/build-lite.json would look like this: [
"build/boot.js",
"../URL/URL.js",
"../WeakMap/WeakMap.js",
"../MutationObserver/MutationObserver.js",
"../HTMLImports/build.json",
"../CustomElements/build.json",
"../Template/Template.js",
"unresolved.js"
] |
Thanks for the issue. It has been a great while since this issue was opened. Sadly, this issue misses a live reproduction with the most recent version of the webcomponents polyfill for us to be able to debug and potentially fix. Versions 1 of the polyfills fix a large amount of issues, probably including this one as well. Please see the CONTRIBUTING.md for guidelines on filing issues. You can start from this jsBin template as a starting point and link it in the issue template under "Live Demo". Feel free to file a new issue following these instructions if you can still reproduce this issue with versions 1 of the polyfills. Thank you! |
The commit in this revision b44664e has caused the problem.
MutationOberserve code requires the WeakMap to be defined.
The text was updated successfully, but these errors were encountered: