diff options
Diffstat (limited to 'toolkit/content/aboutSupport.js')
-rw-r--r-- | toolkit/content/aboutSupport.js | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/toolkit/content/aboutSupport.js b/toolkit/content/aboutSupport.js index e66095e20..e9087dfcb 100644 --- a/toolkit/content/aboutSupport.js +++ b/toolkit/content/aboutSupport.js @@ -715,7 +715,8 @@ Serializer.prototype = { let hasText = false; for (let child of elem.childNodes) { if (child.nodeType == Node.TEXT_NODE) { - let text = this._nodeText(child); + let text = this._nodeText( + child, (child.classList && child.classList.contains("endline"))); this._appendText(text); hasText = hasText || !!text.trim(); } @@ -742,7 +743,7 @@ Serializer.prototype = { } }, - _startNewLine: function (lines) { + _startNewLine: function () { let currLine = this._currentLine; if (currLine) { // The current line is not empty. Trim it. @@ -754,7 +755,7 @@ Serializer.prototype = { this._lines.push(""); }, - _appendText: function (text, lines) { + _appendText: function (text) { this._currentLine += text; }, @@ -777,7 +778,8 @@ Serializer.prototype = { let col = tableHeadingCols[i]; if (col.localName != "th" || col.classList.contains("title-column")) break; - colHeadings[i] = this._nodeText(col).trim(); + colHeadings[i] = this._nodeText( + col, (col.classList && col.classList.contains("endline"))).trim(); } } let hasColHeadings = Object.keys(colHeadings).length > 0; @@ -804,7 +806,10 @@ Serializer.prototype = { let text = ""; if (colHeadings[j]) text += colHeadings[j] + ": "; - text += this._nodeText(children[j]).trim(); + text += this._nodeText( + children[j], + (children[j].classList && + children[j].classList.contains("endline"))).trim(); this._appendText(text); this._startNewLine(); } @@ -820,7 +825,10 @@ Serializer.prototype = { if (this._ignoreElement(trs[i])) continue; let children = trs[i].querySelectorAll("th,td"); - let rowHeading = this._nodeText(children[0]).trim(); + let rowHeading = this._nodeText( + children[0], + (children[0].classList && + children[0].classList.contains("endline"))).trim(); if (children[0].classList.contains("title-column")) { if (!this._isHiddenSubHeading(children[0])) this._appendText(rowHeading); @@ -834,7 +842,10 @@ Serializer.prototype = { // queued up from querySelectorAll earlier. this._appendText(rowHeading + ": "); } else { - this._appendText(rowHeading + ": " + this._nodeText(children[1]).trim()); + this._appendText(rowHeading + ": " + this._nodeText( + children[1], + (children[1].classList && + children[1].classList.contains("endline"))).trim()); } } this._startNewLine(); @@ -846,8 +857,16 @@ Serializer.prototype = { return elem.classList.contains("no-copy"); }, - _nodeText: function (node) { - return node.textContent.replace(/\s+/g, " "); + _nodeText: function (node, endline) { + let whiteChars = /\s+/g + let whiteCharsButNoEndline = /(?!\n)[\s]+/g; + let _node = node.cloneNode(true); + if (_node.firstElementChild && + (_node.firstElementChild.nodeName.toLowerCase() == "button")) { + _node.removeChild(_node.firstElementChild); + } + return _node.textContent.replace( + endline ? whiteCharsButNoEndline : whiteChars, " "); }, }; @@ -919,7 +938,7 @@ function setupEventListeners() { PlacesDBUtils.checkAndFixDatabase(function(aLog) { let msg = aLog.join("\n"); $("verify-place-result").style.display = "block"; - $("verify-place-result").classList.remove("no-copy"); + $("verify-place-result-parent").classList.remove("no-copy"); $("verify-place-result").textContent = msg; }); }); |