Use $.html() instead of setting innerHTML when inserting diff fragments.
Review Request #13521 — Created Feb. 5, 2024 and submitted — Latest diff uploaded
When loading the fragments into the diff viewer page, we used
innerHTML
in order to gain a slight performance boost. When using
rendered review UI content for binary files, the contents often contain
<script>
tags, and just settinginnerHTML
doesn't work for this.
JQuery's$.html()
method checks for these and changes its behavior to
do the right thing.
- Ran js-tests.
- Added a file attachment for an image file in a diff. Saw that the
image review UI was rendered into the diff entry for that file.