Skip to content

Commit

Permalink
Fix #6 by converting diff-match-patch html to xhtml
Browse files Browse the repository at this point in the history
Signed-off-by: Alan D. Tse <alandtse@gmail.com>
  • Loading branch information
alandtse committed Dec 16, 2018
1 parent 7d73685 commit 9879bc2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/scripts/contentscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function displayDiff(html, time=processTime){
html = spdx[0].html;
time = spdx[0].time;
var spdxid = spdx[0].spdxid;
var title = `<a href="https://spdx.org/licenses/${spdxid}.html">${spdxid}</a>`;
var title = `<a href="https://spdx.org/licenses/${spdxid}.html" target="_blank">${spdxid}</a>`;
var timehtml = ' processed in '+(time+processTime)/ 1000+'s<br />';
updateBubbleText(title + timehtml + html);
var el = document.getElementById("licenses").addEventListener("change", function () {
Expand Down Expand Up @@ -257,6 +257,9 @@ function renderBubble(mouseX, mouseY, selection) {

function updateBubbleText(text) {
var bubbleDOMText = $('#bubble_text')[0];
//convert html to xhtml
//concept from https://stackoverflow.com/a/12092919
text = new XMLSerializer().serializeToString(new DOMParser().parseFromString(text, 'text/html'));
bubbleDOMText.innerHTML = text;
}

Expand Down

0 comments on commit 9879bc2

Please # to comment.