Skip to content
This repository was archived by the owner on Dec 28, 2024. It is now read-only.

Exception with absolute URLs on Polymer 1.6.1 #86

Closed
Odaeus opened this issue Aug 2, 2016 · 1 comment
Closed

Exception with absolute URLs on Polymer 1.6.1 #86

Odaeus opened this issue Aug 2, 2016 · 1 comment

Comments

@Odaeus
Copy link

Odaeus commented Aug 2, 2016

Description

A very recent change in Polymer due to Polymer/polymer#2448 causes the following exception to be thrown when using an absolute URL as the image src:

VM1527:1 Uncaught TypeError: Failed to construct 'URL': Invalid URL
    at TypeError (native)
    at eval (eval at evaluate (unknown source), <anonymous>:1:1)
    at iron-image._computeImgDivARIALabel (http://localhost:3001/assets/application-658e89886904e8ba3c8a9b98211302f287e1e8e6f5f8aa17ac61a231bfd0ac6f.html:19972:31)
    at iron-image._annotatedComputationEffect (http://localhost:3001/assets/application-658e89886904e8ba3c8a9b98211302f287e1e8e6f5f8aa17ac61a231bfd0ac6f.html:4494:24)

I think this is because new URL() expects a full URL with domain and protocol but now Polymer.ResolveUrl.resolveUrl() is returning the original absolute path without modification.

I think the solution is to change

var pathComponents = (new URL(this._resolveSrc(this.src))).pathname.split("/");
to supply the second parameter for URL() (this.ownerDocument.baseURI).

Steps to reproduce

  1. Add an iron-image element with an absolute path as the src attribute and no alt value set.
@httx
Copy link

httx commented Aug 2, 2016

Also happens when using paper-card (which imports iron-image) without the heading attribute.

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

No branches or pull requests

3 participants