Skip to content

faulty check for initialPop #516

Open
@bbken

Description

@bbken

When run in Safari 7.0.5, OS X 10.9.4, initialPop is set to false by the following code block.

// Non-webkit browsers don't fire an initial popstate event
if ('state' in window.history) {
  initialPop = false
}

However, https://developer.mozilla.org/en-US/docs/Web/Events/popstate states that an initial popstate event does indeed fire in Safari: "Browsers tend to handle the popstate event differently on page load. Chrome (prior to v34) and Safari always emit a popstate event on page load, but Firefox doesn't." I have confirmed this behavior in my own testing.

Particularly, Safari will sometimes fire the popstate event as the initially loaded JS is executing (the exact timing of the popstate in Safari seems non-deterministic, and based on factors that I have not yet come to understand). Since pjax is unaware that my version of Safari on my version of OS X, performs an initial pop, a pjax request that fires as soon as the page loads will incorrectly be cancelled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions