diff options
Diffstat (limited to 'src/bootstrap/google-prettify/prettify.js')
| -rw-r--r-- | src/bootstrap/google-prettify/prettify.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/bootstrap/google-prettify/prettify.js b/src/bootstrap/google-prettify/prettify.js index c70e9524..b18fc223 100644 --- a/src/bootstrap/google-prettify/prettify.js +++ b/src/bootstrap/google-prettify/prettify.js @@ -1350,11 +1350,13 @@ var REGEXP_PRECEDER_PATTERN = '(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[ * or the 1-indexed number of the first line in sourceCodeHtml. */ function prettyPrintOne(sourceCodeHtml, opt_langExtension, opt_numberLines) { - var container = document.createElement('pre'); + // PATCHED: http://code.google.com/p/google-code-prettify/issues/detail?id=213 + var container = document.createElement('div'); // This could cause images to load and onload listeners to fire. // E.g. <img onerror="alert(1337)" src="nosuchimage.png">. // We assume that the inner HTML is from a trusted source. - container.innerHTML = sourceCodeHtml; + container.innerHTML = '<pre>' + sourceCodeHtml + '</pre>'; + container = container.firstChild; if (opt_numberLines) { numberLines(container, opt_numberLines, true); } |
