From 38c0e794b2a46545ed2b31d5ddfd27cd533c1d3d Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Thu, 23 Sep 2010 14:23:25 +0200 Subject: innerHTML is a good servant ... scrap it, it is bad servant even. --- lib/rhbzpage.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'lib/rhbzpage.js') diff --git a/lib/rhbzpage.js b/lib/rhbzpage.js index c3d86ba..9bbc81f 100644 --- a/lib/rhbzpage.js +++ b/lib/rhbzpage.js @@ -311,13 +311,9 @@ RHBugzillaPage.prototype.pasteBacktraceInComments = function() { // TODO we need to go through all backtrace attachments, but // just the first one will do for now, we would need to do async // parsing - console.log("btAttachments = " + btAttachments.toSource()); btAttachments.forEach(function(x) { var attURL = "https://bugzilla.redhat.com/attachment.cgi?id=" + x[1]; - console.log("attURL = " + attURL); - console.log("this.btSnippet = " + this.btSnippet); - console.log("btparsed = " + this.idContainsWord("status_whiteboard", 'btparsed')); if ((!this.btSnippet) && (!this.idContainsWord("status_whiteboard", 'btparsed'))) { var that = this; @@ -388,8 +384,10 @@ RHBugzillaPage.prototype.addNewAttachmentRow = function addNewAttachmentRow(orig var newTRElem = origAtt[4].cloneNode(true); // fix number of the attachment - newTRElem.innerHTML = newTRElem.innerHTML.replace(origAtt[1], newAttId); - console.log("newTRElem = " + newTRElem.innerHTML); + Array.forEach(newTRElem.getElementsByTagName("a"), function (aEl) { + aEl.setAttribute("href", + aEl.getAttribute("href").replace(origAtt[1], newAttId)); + }); var aElements = newTRElem.getElementsByTagName("a"); aElements[0].setAttribute("name","parsed-backtrace.txt"); @@ -402,7 +400,6 @@ RHBugzillaPage.prototype.addNewAttachmentRow = function addNewAttachmentRow(orig var vcardSpan = newTRElem.getElementsByClassName("vcard")[0]; if (vcardSpan !== undefined) { - console.log("vcardSpan = " + vcardSpan); var vcardSpanClassList = vcardSpan.classList; if (/@redhat\.com/.test(this.login) && !vcardSpanClassList.contains("redhat_user")) { vcardSpanClassList.add("redhat_user"); @@ -415,7 +412,6 @@ RHBugzillaPage.prototype.addNewAttachmentRow = function addNewAttachmentRow(orig } var elem = newTRElem.querySelector("td:last-of-type"); - console.log("elem.innerHTML = " + elem.innerHTML); this.createDeadLink("showBacktrace", "show BT", elem, this.showAttachment, newAttId, false); -- cgit