Skip to content
This repository has been archived by the owner on Jul 28, 2018. It is now read-only.

Preserve anchors - Fix #110 #125

Merged
merged 1 commit into from Dec 1, 2012
Merged

Conversation

reed
Copy link
Collaborator

@reed reed commented Dec 1, 2012

I came up with a few ways to fix the problem (#110), but I think this one is the best because it takes care of two issues.

Unless I'm missing something, the purpose of the reflectRedirectedUrl function is to update the newly pushed (from reflectNewUrl) history state in the event the ajax request is redirected. However, right now it's doing it whether there was a redirect or not, which most of the time will be unnecessary. The lost anchors are a side effect of this, since it replaces the current state with the X-XHR-Current-Location value from the server (which omits anchors). As far as I can tell, my solution preserves the anchors while eliminating unnecessary replaceState calls.

@kossnocorp
Copy link

👍

@reed
Copy link
Collaborator Author

reed commented Dec 1, 2012

It's just personal preference. I like the way I did it, but I'd have no issue with changing it. I'll leave it up to @dhh to decide how he wants it before adding another commit.

@kossnocorp
Copy link

I see. Also since Turbolinks is completly bracketless it's pointless to try add brackets to improve readability. I'm just point you to opportunity remove two more brackets 😸.

@yasuoza
Copy link
Contributor

yasuoza commented Dec 1, 2012

👍

dhh added a commit that referenced this pull request Dec 1, 2012
@dhh dhh merged commit 5f156b3 into turbolinks:master Dec 1, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants