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

Need consistent path behavior #651

Closed
robdodson opened this issue Jul 21, 2014 · 7 comments
Closed

Need consistent path behavior #651

robdodson opened this issue Jul 21, 2014 · 7 comments
Assignees
Labels

Comments

@robdodson
Copy link
Contributor

Original thread: https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/polymer-dev/JcBQZCPamcY/OMKhLetXg-4J

If I create an element that looks like this:

<polymer-element name="x-foo">
  <template>
    <template repeat="{{link in links}}">
      <div><a href="#ok{{link}}">Ok Hash Link {{link}}</a></div>
    </template>
    <div><a href="#bad">Bad Hash Link</a></div>
  </template>
  <script>
    Polymer('x-foo', {
      links : [2,3,4]
    });
  </script>
</polymer-element>

and then import it into my project, it will treat the hrefs differently. The href's inside of the repeating template will look like this:

<a href="#ok2">
<a href="#ok3">
<a href="#ok4">

but the href outside of the repeating template will look like this:

<a href="x-foo.html#bad">Bad Hash Link</a>
@erikringsmuth
Copy link

I noticed this same issue here:
http://erikringsmuth.github.io/app-router/#/notes
erikringsmuth/app-router#10

It goes a little further than hash links. Every relative path is relative to the imported document. This makes sense for <link> and <script> tags since they're used to load dependencies. <a> tags also follow this pattern. Does this make sense for <a> tags in general?

@ebidel ebidel added p1 and removed p2 labels Nov 5, 2014
@ebidel
Copy link
Contributor

ebidel commented Nov 5, 2014

Ping? Bumping priority as we're running into it with a large 🎅 project.

My current workaround is elliot's, which is to use an expression + baseURI

<a href="{{ baseURI }}#calendar">

@devinivy
Copy link

Yes, we're hoping for a fix for use on a big project too. I think @erikringsmuth's idea of treating anchor tags differently may be the ideal approach.

@ebidel
Copy link
Contributor

ebidel commented Dec 20, 2014

@azakus @sorvell can anyone take a look at this?

@ssorallen ssorallen assigned ssorallen and unassigned dfreedm Jan 14, 2015
@ssorallen
Copy link
Contributor

@sorvell, was it intentional to rewrite href for anchor elements? It doesn't seem like those should be rewritten at all.

@sorvell
Copy link
Contributor

sorvell commented Jan 14, 2015

Yes, the idea is that you should always be able to link resources with paths relative to the importing document. If it's an absolute url or a # based one we should bail.

@dfreedm
Copy link
Member

dfreedm commented Jan 14, 2015

The rewriter doesn't check that the node is an anchor, it just rewrites href. The simplest fix is to ignore hash-only hrefs for rewriting.

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

7 participants