Add a couple comments

This commit is contained in:
Dan Stillman 2015-08-27 18:00:16 +01:00
parent 1c087270e3
commit d3c4689973
2 changed files with 6 additions and 1 deletions

View File

@ -468,10 +468,13 @@ Zotero.Translate.ItemSaver.prototype = {
doc = (new DOMParser()).parseFromString(result, "text/html");
} catch(e) {}
// If DOMParser fails, use document.implementation.createHTMLDocument
// If DOMParser fails, use document.implementation.createHTMLDocument,
// as documented at https://developer.mozilla.org/en-US/docs/Web/API/DOMParser
if(!doc) {
doc = document.implementation.createHTMLDocument("");
var docEl = doc.documentElement;
// AMO reviewer: This code is not run in Firefox, and the document
// is never rendered anyway
docEl.innerHTML = result;
if(docEl.children.length === 1 && docEl.firstElementChild === "html") {
doc.replaceChild(docEl.firstElementChild, docEl);

View File

@ -233,6 +233,8 @@ Zotero.QuickCopy = new function() {
for (var i=0; i<notes.length; i++) {
var div = doc.createElement("div");
div.className = "zotero-note";
// AMO reviewer: This documented is never rendered (and the inserted markup
// is sanitized anyway)
div.insertAdjacentHTML('afterbegin', notes[i].getNote());
container.appendChild(div);
textContainer.appendChild(textDoc.importNode(div, true));