1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-24 06:59:52 +01:00

wombat: improve createElementNS override to set prototype, just assign

window.parent directly
This commit is contained in:
Ilya Kreymer 2015-01-29 10:13:32 -08:00
parent bf3d256a51
commit 043ad5c860

View File

@ -537,16 +537,20 @@ _WBWombat = (function() {
//============================================ //============================================
function init_createElementNS_fix() function init_createElementNS_fix()
{ {
if (!document.createElementNS) { if (!document.createElementNS ||
!Document.prototype.createElementNS) {
return; return;
} }
document._orig_createElementNS = document.createElementNS; document._orig_createElementNS = document.createElementNS;
document.createElementNS = function(namespaceURI, qualifiedName) var createElementNS_fix = function(namespaceURI, qualifiedName)
{ {
namespaceURI = extract_orig(namespaceURI); namespaceURI = extract_orig(namespaceURI);
return document._orig_createElementNS(namespaceURI, qualifiedName); 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); window.WB_wombat_top = find_next_top(window.self);
if (window.parent == window.top) { if (window.parent == window.top) {
window.WB_wombat_parent = window; window.parent = window;
} else {
window.WB_wombat_parent = window.parent;
} }
} else { } else {
window.top.WB_wombat_location = new WombatLocation(window.top.location); window.top.WB_wombat_location = new WombatLocation(window.top.location);
window.WB_wombat_top = window.top; window.WB_wombat_top = window.top;
window.WB_wombat_parent = window.parent;
} }
} else { } else {
window.WB_wombat_top = window.top; window.WB_wombat_top = window.top;
window.WB_wombat_parent = window.parent;
} }
//if (window.opener) { //if (window.opener) {