PolymerElements / iron-component-page

A reusable landing page for elements
36 stars 32 forks source link

Element no longer works in IE11 due to URL API usage #128

Open brettpostin opened 7 years ago

brettpostin commented 7 years ago

Description

After upgrading to Polymer 2 and webcomponents v1, iron-component-page no longer works in IE11.

It fails in the _srcChanged function on the use of the URL api:

} else if (this.src) {
    srcUrl = new URL(this.src, this.base).toString();
} else {
    var base = _baseUrl(this.base);
    srcUrl = new URL(base.match(/([^\/]*)\/$/)[1] + ".html", base).toString();
}

IE11 does not support this API. Checking the source history I noticed the element has used this API since it's creation, which made me wonder how my app previously worked in Polymer 1.x.

I believe the URL api was previously polyfilled in the webcomponents.js suite. It no longer appears to be in the new v1 polyfills.

Steps to reproduce

The following code sample demonstrates the lack of availability of the URL api in IE11 after loading the polyfills.

<!doctype html>
<html>
<head>
</head>
<body>
    <script src="/bower_components/webcomponentsjs/webcomponents-loader.js"></script>
    <link rel="import" href="/bower_components/polymer/polymer.html">
    <script>
        var x = new URL('http://helloworld.com');
        console.log(x);
    </script>
</body>
</html>

Browsers Affected

MrMcGibblets commented 7 years ago

Hey,

Yes, you are correct, the URL polyfill was removed from the webcomponents.js suite.

I believe this was a breaking change that was introduced on purpose, I think what they are trying to do is in 2.0 give us more freedom on the polyfills we use.

See the below issue raised on the iron-location element and in particular Elliott Marquez's(e111077) response.

https://github.com/PolymerElements/iron-location/issues/74

Hopefully, this helps you and you can import the polyfill yourself, or at least a bit more background to this issue.