Fix hashchange closing #subscriptions on IE.

This fixes an issue where Array.prototype.split is called on an
undefined instance due to the EventTarget.oldURL property not being
recorded in IE. We fix this by recording it ourselves.
This commit is contained in:
brockwhittaker 2017-02-01 16:51:48 -08:00 committed by Tim Abbott
parent 5eb5fa3f31
commit 894f0b5bf0
1 changed files with 3 additions and 1 deletions

View File

@ -210,6 +210,7 @@ function do_hashchange(from_reload) {
var ignore = {
flag: false,
prev: null,
old_hash: typeof window !== "undefined" ? window.location.hash : "#",
};
function get_main_hash(hash) {
@ -231,8 +232,9 @@ function hide_overlays() {
function hashchanged(from_reload, e) {
var old_hash;
if (e) {
old_hash = "#" + e.oldURL.split(/#/).slice(1).join("");
old_hash = "#" + (e.oldURL || ignore.old_hash).split(/#/).slice(1).join("");
ignore.last = old_hash;
ignore.old_hash = window.location.hash;
}
var base = get_main_hash(window.location.hash);