Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polymer 1.9 resolveUrl does not work as intended #4532

Closed
2 of 6 tasks
e111077 opened this issue Apr 14, 2017 · 2 comments
Closed
2 of 6 tasks

Polymer 1.9 resolveUrl does not work as intended #4532

e111077 opened this issue Apr 14, 2017 · 2 comments
Assignees
Labels

Comments

@e111077
Copy link
Contributor

e111077 commented Apr 14, 2017

Description

this.resolveUrl in a properties block is simply just not working as intended.

Live Demo

Wrong: http://jsbin.com/ridukodefe/2/edit?html,console
Intended: https://jsbin.com/sekeyeheso/1/edit?html,console

Steps to Reproduce

  1. Create element
  2. Add a property in the properties block
  3. set value: function() { return this.resolveUrl('./relativeUrlThatExists')}
  4. set the url of resolveUrl to something that exists.
  5. observe that it does not find the proper url

Expected Results

it should return the actual absolute url

Actual Results

it just returns the same relative url entered

Browsers Affected

  • Chrome
  • Firefox
  • Edge
  • Safari 9
  • Safari 8
  • IE 11

Versions

  • Polymer: v1.9.0
  • webcomponents: v0
@kevinpschaaf
Copy link
Member

Resolved via #4533.

@daniele-orlando
Copy link

daniele-orlando commented Sep 12, 2017

I can still reproduce this bug on Polymer 1.9.3 and Polymer-Cli 1.5.2 under Vulcanize.

this.resolveUrl('../my-lib/element.html')
// => ../my-lib/element.html

The only differences between the state of resolveUrl in the Vulcanized and not-Vulcanized code is this:

not-Vulcanized

tempDocBase.href
// http://localhost:8000/bundle/my-app/

Vulcanized

tempDocBase.href
// /bundle/my-app/

The HTML Base tag seams to not work with only the path portion of the uri.


Update 1:
tempDocBase.href is computed from the _importPath variable which in turn is computed from the import link (not-Vulcanized) or the assetpath attribute of the dom-module (Vulcanized).

not-Vulcanized

var assetPath = module.getAttribute('assetpath') || '';
// ''
var importURL = Polymer.ResolveUrl.resolveUrl(assetPath, module.ownerDocument.baseURI);
// http://localhost:8000/bundle/my-app/my-app.html
this._importPath = Polymer.ResolveUrl.pathFromUrl(importURL);
// http://localhost:8000/bundle/my-app/

Vulcanized

var assetPath = module.getAttribute('assetpath') || '';
// /bundle/my-app/
var importURL = Polymer.ResolveUrl.resolveUrl(assetPath, module.ownerDocument.baseURI);
// /bundle/my-app/
this._importPath = Polymer.ResolveUrl.pathFromUrl(importURL);
// /bundle/my-app/

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

No branches or pull requests

4 participants