Use $.html() instead of setting innerHTML when inserting diff fragments.

Review Request #13521 — Created Feb. 5, 2024 and submitted — Latest diff uploaded

Information

Review Board
master

Reviewers

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 setting innerHTML 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.

Diff Revision 1 (Latest)

Commits

First Last Summary ID Author
Use $.html() instead of setting innerHTML when inserting diff fragments.
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 setting `innerHTML` doesn't work for this. JQuery's `$.html()` method checks for these and changes its behavior to do the right thing. Testing Done: - 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.
90aa5f4593debb199de351a0e43a09d2678dea61 David Trowbridge
reviewboard/static/rb/js/reviews/views/diffViewerPageView.ts
Loading...