@@ -927,20 +927,25 @@ exports.load = function() {
927927 Object . keys ( window ) . forEach ( function ( i ) {
928928 var desc = Object . getOwnPropertyDescriptor ( global , i ) ;
929929 originalProperties [ i ] = desc ;
930- global . __defineGetter__ ( i , function ( ) {
931- return overriddenValues [ i ] || window [ i ] ;
932- } ) ;
933- global . __defineSetter__ ( i , function ( value ) {
934- if ( ! overridableProperties . includes ( i ) ) {
935- console . log ( "attempt to set " + i ) ;
936- } else if ( value === window [ i ] ) {
937- delete overriddenValues [ i ] ;
938- if ( ! loaded ) {
939- unloadProperty ( i ) ;
930+ Object . defineProperty ( global , i , {
931+ get : function ( ) {
932+ return overriddenValues [ i ] || window [ i ] ;
933+ } ,
934+ set : function ( value ) {
935+ if ( ! overridableProperties . includes ( i ) ) {
936+ console . trace ( "attempt to set " + i ) ;
937+ } else if ( value === window [ i ] ) {
938+ delete overriddenValues [ i ] ;
939+ if ( ! loaded ) {
940+ unloadProperty ( i ) ;
941+ }
942+ } else {
943+ overriddenValues [ i ] = value ;
940944 }
941- } else {
942- overriddenValues [ i ] = value ;
943- }
945+ } ,
946+ // writable: true,
947+ enumerable : true ,
948+ configurable : true ,
944949 } ) ;
945950 } ) ;
946951 loaded = true ;
@@ -954,6 +959,8 @@ exports.loadInBrowser = function(global, $setSize) {
954959 delete global . ResizeObserver ;
955960 global . __origRoot__ = global . document . documentElement ;
956961 global . __origBody__ = global . document . body ;
962+ global . document . createElementOrig = global . document . createElement ;
963+ global . document . createTextNodeOrig = global . document . createTextNode ;
957964 Object . keys ( window ) . forEach ( function ( i ) {
958965 if ( i != "document" && i != "window" ) {
959966 delete global [ i ] ;
@@ -964,7 +971,6 @@ exports.loadInBrowser = function(global, $setSize) {
964971 var val = window . document [ i ] ;
965972 if ( typeof val == "function" ) {
966973 if ( i == "createElement" ) {
967- global . document . createElementOrig = global . document . createElement ;
968974 val = function ( n ) {
969975 if ( n == "script" )
970976 return global . document . createElementOrig ( n ) ;
0 commit comments