How can I solve the following error when trying to access a polymer v 2.0 app on ios' safari?
Uncaught TypeError: Class constructor m cannot be invoked without 'new' from custom-elements-es5-adaptor.
Running the the polymer v2.0 starter kit works fine in chrome, it however throws the above error when trying it for ios.
https://github.com/webcomponents/webcomponentsjs#custom-elements-es5-adapterjs
According to the spec, Custom Elements must be ES6 classes ( https://html.spec.whatwg.org/multipage/scripting.html#custom-element-conformance ). Since most projects need to support a wide range of browsers that don't necessary support ES6, it may make sense to compile your project to ES5. However, ES5-style custom element classes will not work with native Custom Elements because ES5-style classes cannot properly extend ES6 classes, like HTMLElement.
To work around this, load custom-elements-es5-adapter.js before declaring new Custom Elements.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.