polymer icon indicating copy to clipboard operation
polymer copied to clipboard

Polymer 1.x application doesn't work with Chrome v80

Open andriyaucar opened this issue 5 years ago • 14 comments

Description

I have Angular 5.x project. It works fine with Chrome 79. But after Chrome 80 version update, lots of errors occured. I did instructions in https://developers.google.com/web/updates/2019/07/web-components-time-to-upgrade but it still doesn't work. Do you have any comment or recommendation?

Browsers Affected

  • [x] Chrome
  • [ ] Firefox
  • [ ] Edge
  • [ ] Safari 11
  • [ ] Safari 10
  • [ ] IE 11

Versions

  • Polymer: v1.9.1
  • webcomponents: v0.7.24

And I used

<script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<script>
  window.Polymer = {
    dom: 'shadow',
    lazyRegister: true,
    useNativeCSSProperties: true
  };
</script>

andriyaucar avatar Feb 10 '20 12:02 andriyaucar

Hello, andryaucar... put the polyfills and if you use Raven.js - Sentry SDK for JavaScript use a condicional to test raven is loaded.. for me works!!!

andre-chiquito-ir avatar Feb 10 '20 19:02 andre-chiquito-ir

My project have polyfills.ts as below;

import 'core-js/es6/object';
import 'core-js/es6/string';
import 'core-js/es6/array';
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';

And I don't use Raven.js.

The problem still continues.

andriyaucar avatar Feb 10 '20 19:02 andriyaucar

@andriyaucar what errors are you seeing? And is there an application URL you can share, or is this an internal app?

arthurevans avatar Feb 10 '20 20:02 arthurevans

I see below errors on console;

zone.js:2969 GET http://localhost:xx/bower_components/iron-dropdown/iron-dropdown.html 404 (Not Found)
zone.js:2969 GET http://localhost:xx/bower_components/iron-ajax/iron-ajax.html 404 (Not Found)
zone.js:2969 GET http://localhost:xx/bower_components/promise-polyfill/promise-polyfill-lite.html 404 (Not Found)

Yes it is internal app.

andriyaucar avatar Feb 10 '20 20:02 andriyaucar

And I see below warnings as well;

HTML Imports is deprecated and has now been removed as of M80. See https://www.chromestatus.com/features/5144752345317376 and https://developers.google.com/web/updates/2019/07/web-components-time-to-upgrade for more details.

vendor.bundle.js:96329 Current document does not have a doctype. This may cause some Angular Material components not to behave as expected.

webpackJsonp../node_modules/@angular/material/esm5/core.es5.js.MatCommonModule._checkDoctypeIsDefined @ vendor.bundle.js:96329
vendor.bundle.js:96370 Could not find HammerJS. Certain Angular Material components may not work correctly.

andriyaucar avatar Feb 11 '20 12:02 andriyaucar

hi @andriyaucar, my Polymer projects are using this soluctions:

    <script src="bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
    <script src="bower_components/webcomponentsjs/CustomElements.min.js"></script>
    <script src="bower_components/webcomponentsjs/HTMLImports.min.js"></script>

and

<script>
      // Setup Polymer options
      window.Polymer = {
        lazyRegister: true,
        passiveTouchGestures: true
      };

      // Load webcomponentsjs polyfill if browser does not support native Web Components
      (function() {
        'use strict';

        var onload = function() {
          // For native Imports, manually fire WebComponentsReady so user code
          // can use the same code path for native and polyfill'd imports.
          if (!window.HTMLImports) {
            document.dispatchEvent(
              new CustomEvent('WebComponentsReady', {bubbles: true})
            );
          }
        };

        var webComponentsSupported = (
          'registerElement' in document
          && 'import' in document.createElement('link')
          && 'content' in document.createElement('template')
        );

        if (!webComponentsSupported) {
          var script = document.createElement('script');
          script.async = true;
          script.src = '/bower_components/webcomponentsjs/webcomponents-lite.min.js';
          script.onload = onload;
          document.head.appendChild(script);
        } else {
          onload();
        }
      })();

      // Workaround due to an issue on older versions of IE11 running on W10
      if (!window.location.origin) {
        window.location.origin = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port: '');
      }
    </script>

and my bower.json has this dependencie

{
"webcomponentsjs": "^0.7.24"
}

matheus-pantoja-ir avatar Feb 11 '20 13:02 matheus-pantoja-ir

I am also having the same issue with an internal app.

The application is build on Angular 1.5

As per the site "https://www.polymer-project.org/blog/2018-10-02-webcomponents-v0-deprecations" I have added in the following for loading polyfills

but adding or removing this script does not have any effect on the UI.

Kindly help

adesh70695 avatar Feb 23 '20 10:02 adesh70695

Hi @andriyaucar ... Hope you have resolved this. If not, there are a few suggestions here: https://github.com/Polymer/polymer/issues/5633#issuecomment-598918251

arthurevans avatar Mar 13 '20 21:03 arthurevans

I tried to all suggestions that in issue. I have not resolved it. I did some workarounds unfortunately.

andriyaucar avatar Apr 06 '20 07:04 andriyaucar

@arthurevans Hi Athur

Even I am facing same issue for my internal project which uses Polymerjs1. I have loaded webcomponents-lite.min.js as suggested in https://developers.google.com/web/updates/2019/07/web-components-time-to-upgrade#load-the-v0-polyfills. But it still does not work.

DO you know any workaround?

diksha0291 avatar Apr 16 '20 14:04 diksha0291

The issue is fixed for me now. Check the path for webcomponents and add them in correct place.

On Thu, 16 Apr, 2020, 8:24 pm diksha0291, [email protected] wrote:

Hi Andriya

Even I am facing same issue for my internal project which uses Polymerjs1. I have loaded webcomponents-lite.min.js as suggested in https://developers.google.com/web/updates/2019/07/web-components-time-to-upgrade#load-the-v0-polyfills. But it still does not work.

DO you know any workaround?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Polymer/polymer/issues/5626#issuecomment-614703742, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOUIQWFLBVF32IWELINWLJDRM4LZPANCNFSM4KSNNZ5Q .

adesh70695 avatar Apr 19 '20 13:04 adesh70695

I have added correct path and it is giving below errors now

Uncaught TypeError: flags.log.split is not a function at webcomponents-lite.js:33 at webcomponents-lite.js:55 index.html.js:13 Uncaught TypeError: Cannot set property '_containerClasses' of null at index.html.js:13 webcomponents-lite.min.js:11 Uncaught TypeError: t.log.split is not a function at webcomponents-lite.min.js:11 at webcomponents-lite.min.js:11

Webcomponent file is not able to load any imports

diksha0291 avatar Apr 20 '20 12:04 diksha0291

I have somehow fixed the errors that i was facing, it was due to loading of webcomponent js in multiple html.

The new issue now I am facing is all files of <link rel="import" are loaded by webcomponent js , but they are not imported in document. Could you please assist here

image image

diksha0291 avatar Apr 21 '20 13:04 diksha0291

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 02 '21 16:06 stale[bot]