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

href="#" changed in output #238

Closed
DartBot opened this issue Jun 5, 2015 · 11 comments
Closed

href="#" changed in output #238

DartBot opened this issue Jun 5, 2015 · 11 comments

Comments

@DartBot
Copy link

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/3472245?v=3" align="left" width="96" height="96"hspace="10"> Issue by markhats
Originally opened as dart-lang/sdk#20034


When href="#" is specified on an anchor element, it gets changed to simply href="" in the output html. This causes a page reload when clicking on the element rather than allowing the element to look like a hyperlink but actually go nowhere.

e.g

<a href="#" class="dropdown-toggle" data-toggle="dropdown">Temp</a>

becomes:

<a href="" class="dropdown-toggle" data-toggle="dropdown">Temp</a>

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/5479?v=3" align="left" width="48" height="48"hspace="10"> Comment by sethladd


Is this inside of a polymer app?

What is outputting the HTML?


Added NeedsInfo label.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/3472245?v=3" align="left" width="48" height="48"hspace="10"> Comment by markhats


Yes, this is a Polymer app.

I'm talking about the output html that is produced when clicking "Run in Dartium" or "Run as Javascript".

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/5479?v=3" align="left" width="48" height="48"hspace="10"> Comment by sethladd


Thanks for the additional info.

Does this happen with a straight JavaScript polymer app?


Added Pkg-Polymer, Area-Pkg, Triaged labels.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/2049220?v=3" align="left" width="48" height="48"hspace="10"> Comment by sigmundch


My guess this is something that happens in our build process ("run in dartium" today is using pub serve and is running our transformers).

Which version of polymer are you using?

We made some recent changes in our transformers that could affect this too.


Removed Priority-Unassigned label.
Added Priority-Medium, PolymerMilestone-Next labels.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/3472245?v=3" align="left" width="48" height="48"hspace="10"> Comment by markhats


I'm using polymer 0.11.0+5.

I haven't tried it in a straight JavaScript polymer app.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/3472245?v=3" align="left" width="48" height="48"hspace="10"> Comment by markhats


Is there any workaround for this issue at the moment? It's quite frustrating as it renders my app pretty unusable unless I take all occurrences of href="#" out.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/984921?v=3" align="left" width="48" height="48"hspace="10"> Comment by jakemac53


This does not appear to be a result of the build process as originally anticipated, if you view the source the href is correct. This also only happens for link tags inside of polymer elements template, and the # gets removed both inside the template and in the resulting usages of the element. I tested with just a normal template and it wasn't happening.


Set owner to @jakemac53.
Added Started label.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/984921?v=3" align="left" width="48" height="48"hspace="10"> Comment by jakemac53


After further testing, this is happening in Polymer js so we probably need to wait for it to get fixed on their end, I have submitted Polymer/polymer#672 to them to track it.


Added MovedToGithub label.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/984921?v=3" align="left" width="48" height="48"hspace="10"> Comment by jakemac53


I did find one hack you can use as a workaround, if you use a binding that just outputs the hashtag as a string that seems to work. You should use the _href version in this case as well to maintain browser support:

<a _href="{{'#'}}">test</a>

It isn't beautiful, but it should unblock you.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/984921?v=3" align="left" width="48" height="48"hspace="10"> Comment by jakemac53


See http://www.polymer-project.org/docs/polymer/databinding-compat.html#binding-to-attributes for more info about _href.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/3472245?v=3" align="left" width="48" height="48"hspace="10"> Comment by markhats


Great, the _href="{{'#'}}" trick works for now.

Thanks.

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

No branches or pull requests

2 participants