diff --git a/CHANGES.md b/CHANGES.md index 17f5dccdf9..e044ae3d71 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -17,6 +17,13 @@ Language Improvements: - none yet. +## Version 9.17.1 + +Fixes: + +- fix(parser): resolve IE 11 issue with Object.freeze() (#2319) [Josh Goebel][] + + ## Version 9.17.0 New languages: diff --git a/src/highlight.js b/src/highlight.js index d8f0a069c6..d00469adda 100644 --- a/src/highlight.js +++ b/src/highlight.js @@ -1104,12 +1104,6 @@ https://highlightjs.org/ }; var constants = [ - hljs.IDENT_RE, - hljs.UNDERSCORE_IDENT_RE, - hljs.NUMBER_RE, - hljs.C_NUMBER_RE, - hljs.BINARY_NUMBER_RE, - hljs.RE_STARTERS_RE, hljs.BACKSLASH_ESCAPE, hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE, @@ -1133,10 +1127,15 @@ https://highlightjs.org/ function deepFreeze (o) { Object.freeze(o); + var objIsFunction = typeof o === 'function'; + Object.getOwnPropertyNames(o).forEach(function (prop) { if (o.hasOwnProperty(prop) && o[prop] !== null && (typeof o[prop] === "object" || typeof o[prop] === "function") + // IE11 fix: https://github.com/highlightjs/highlight.js/issues/2318 + // TODO: remove in the future + && (objIsFunction ? prop !== 'caller' && prop !== 'callee' && prop !== 'arguments' : true) && !Object.isFrozen(o[prop])) { deepFreeze(o[prop]); }