Turbolinks 5 doesn't follow the browser's standard behaviour of ignoring links pointing to "#", so we're preventing the turbolinks events in this situation:
16 lines
459 B
JavaScript
16 lines
459 B
JavaScript
(function() {
|
|
"use strict";
|
|
|
|
// Code by Dom Christie:
|
|
// https://github.com/turbolinks/turbolinks/issues/75#issuecomment-443256173
|
|
document.addEventListener("turbolinks:click", function(event) {
|
|
if (event.target.getAttribute("href").charAt(0) === "#") {
|
|
Turbolinks.controller.pushHistoryWithLocationAndRestorationIdentifier(
|
|
event.data.url,
|
|
Turbolinks.uuid()
|
|
);
|
|
event.preventDefault();
|
|
}
|
|
});
|
|
}).call(this);
|