File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -99,9 +99,14 @@ exports.escapeXML = function (markup) {
9999 : String ( markup )
100100 . replace ( _MATCH_HTML , encode_char ) ;
101101} ;
102- exports . escapeXML . toString = function ( ) {
102+
103+ // If the Object prototype is frozen, the "toString" property is non-writable. This means that any objects which inherit this property
104+ // cannot have the property changed using an assignment. If using strict mode, attempting that will cause an error. If not using strict
105+ // mode, attempting that will be silently ignored.
106+ // However, we can still explicitly shadow the prototype's "toString" property by defining a new "toString" property on this object.
107+ Object . defineProperty ( exports . escapeXML , 'toString' , function ( ) {
103108 return Function . prototype . toString . call ( this ) + ';\n' + escapeFuncStr ;
104- } ;
109+ } ) ;
105110
106111/**
107112 * Naive copy of properties from one object to another.
You can’t perform that action at this time.
0 commit comments