Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js
- index 6797d81699..e036b0b7b3 100644
- --- a/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js
- +++ b/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js
- @@ -1524,7 +1524,7 @@ WI.DOMTreeElement = class DOMTreeElement extends WI.TreeElement
- else if (nodeNameLowerCase === "style")
- textNodeElement.appendChild(WI.syntaxHighlightStringAsDocumentFragment(textChild.nodeValue().trim(), "text/css"));
- else
- - textNodeElement.textContent = textChild.nodeValue();
- + textNodeElement.textContent = this._convertWhitespaceToEntities(textChild.nodeValue());
- info.titleDOM.append("\u200B");
- @@ -1592,6 +1592,46 @@ WI.DOMTreeElement = class DOMTreeElement extends WI.TreeElement
- return info;
- }
- + MappedCharToEntity = {
- + '\xA0': 'nbsp',
- + '\x93': '#147', // <control>
- + '\xAD': 'shy',
- + '\u2002': 'ensp',
- + '\u2003': 'emsp',
- + '\u2009': 'thinsp',
- + '\u200a': '#8202', // Hairspace
- + '\u200b': '#8203', // ZWSP
- + '\u200c': 'zwnj',
- + '\u200d': 'zwj',
- + '\u200e': 'lrm',
- + '\u200f': 'rlm',
- + '\u202a': '#8234', // LRE
- + '\u202b': '#8235', // RLE
- + '\u202c': '#8236', // PDF
- + '\u202d': '#8237', // LRO
- + '\u202e': '#8238', // RLO
- + '\ufeff': '#65279' // BOM
- + }
- +
- + _convertWhitespaceToEntities(text)
- + {
- + var result = "";
- + var lastIndexAfterEntity = 0;
- + var charToEntity = this.MappedCharToEntity;
- + for (var i = 0, size = text.length; i < size; ++i) {
- + var char = text.charAt(i);
- + if (charToEntity[char]) {
- + result += text.substring(lastIndexAfterEntity, i) + "&" + charToEntity[char] + ";";
- + lastIndexAfterEntity = i + 1;
- + }
- + }
- + if (result) {
- + result += text.substring(lastIndexAfterEntity);
- + return result;
- + }
- + return text;
- + }
- +
- _singleTextChild(node)
- {
- if (!node || this._ignoreSingleTextChild)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement