From 043ad5c860e4054fb26b3f449e045ac538fe40e4 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Thu, 29 Jan 2015 10:13:32 -0800 Subject: [PATCH] wombat: improve createElementNS override to set prototype, just assign window.parent directly --- pywb/static/wombat.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pywb/static/wombat.js b/pywb/static/wombat.js index a185d9f9..e620f65c 100644 --- a/pywb/static/wombat.js +++ b/pywb/static/wombat.js @@ -537,16 +537,20 @@ _WBWombat = (function() { //============================================ function init_createElementNS_fix() { - if (!document.createElementNS) { + if (!document.createElementNS || + !Document.prototype.createElementNS) { return; } document._orig_createElementNS = document.createElementNS; - document.createElementNS = function(namespaceURI, qualifiedName) + var createElementNS_fix = function(namespaceURI, qualifiedName) { namespaceURI = extract_orig(namespaceURI); return document._orig_createElementNS(namespaceURI, qualifiedName); } + + Document.prototype.createElementNS = createElementNS_fix; + document.createElementNS = createElementNS_fix; } //============================================ @@ -941,19 +945,15 @@ _WBWombat = (function() { window.WB_wombat_top = find_next_top(window.self); if (window.parent == window.top) { - window.WB_wombat_parent = window; - } else { - window.WB_wombat_parent = window.parent; + window.parent = window; } } else { window.top.WB_wombat_location = new WombatLocation(window.top.location); window.WB_wombat_top = window.top; - window.WB_wombat_parent = window.parent; } } else { window.WB_wombat_top = window.top; - window.WB_wombat_parent = window.parent; } //if (window.opener) {