Web Inspector: Start using Node.prototype.append
authornvasilyev@apple.com <nvasilyev@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 26 Jul 2015 05:46:30 +0000 (05:46 +0000)
committernvasilyev@apple.com <nvasilyev@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 26 Jul 2015 05:46:30 +0000 (05:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=147301

Convert all instances of element.appendChild(document.createTextNode(aString))
to element.append(aString).

Reviewed by Timothy Hatcher.

* UserInterface/Base/DOMUtilities.js:
* UserInterface/Base/Main.js:
(WebInspector.linkifyLocation):
(WebInspector.linkifyStringAsFragmentWithCustomLinkifier):
* UserInterface/Models/Breakpoint.js:
(WebInspector.Breakpoint.prototype._editBreakpointPopoverContentElement):
* UserInterface/Views/BoxModelDetailsSectionRow.js:
(WebInspector.BoxModelDetailsSectionRow.prototype._updateMetrics):
* UserInterface/Views/CSSStyleDeclarationSection.js:
(WebInspector.CSSStyleDeclarationSection.prototype.refresh):
* UserInterface/Views/CSSStyleDetailsSidebarPanel.js:
(WebInspector.CSSStyleDetailsSidebarPanel):
* UserInterface/Views/ChartDetailsSectionRow.js:
(WebInspector.ChartDetailsSectionRow.prototype._createLegendItem):
* UserInterface/Views/ConsoleMessageView.js:
(WebInspector.ConsoleMessageView.prototype._appendMessageTextAndArguments):
(WebInspector.ConsoleMessageView.prototype._appendFormattedArguments):
* UserInterface/Views/DOMNodeDetailsSidebarPanel.js:
(WebInspector.DOMNodeDetailsSidebarPanel.prototype._refreshAccessibility.accessibilityPropertiesCallback):
(WebInspector.DOMNodeDetailsSidebarPanel.prototype._refreshAccessibility):
* UserInterface/Views/DOMTreeElement.js:
(WebInspector.DOMTreeElement.prototype._insertInLastAttributePosition):
(WebInspector.DOMTreeElement.prototype._buildAttributeDOM):
(WebInspector.DOMTreeElement.prototype._buildTagDOM):
(WebInspector.DOMTreeElement.prototype._nodeTitleInfo):
defaultElement variable is unused, remove it.

* UserInterface/Views/DataGrid.js:
(WebInspector.DataGridNode.prototype.createCell.get if):
(WebInspector.DataGridNode.prototype.createCell):
* UserInterface/Views/DebuggerDashboardView.js:
(WebInspector.DebuggerDashboardView.prototype._rebuildLocation):
* UserInterface/Views/EventListenerSectionGroup.js:
(WebInspector.EventListenerSectionGroup.prototype._functionTextOrLink):
(WebInspector.EventListenerSectionGroup):
* UserInterface/Views/FormattedValue.js:
(WebInspector.FormattedValue.createLinkifiedElementString):
(WebInspector.FormattedValue.createElementForNodePreview):
* UserInterface/Views/ObjectPreviewView.js:
(WebInspector.ObjectPreviewView.prototype._appendEntryPreviews):
(WebInspector.ObjectPreviewView.prototype._appendPropertyPreviews):
* UserInterface/Views/ResourceDetailsSidebarPanel.js:
(WebInspector.ResourceDetailsSidebarPanel.prototype._refreshRequestDataSection):
(WebInspector.ResourceDetailsSidebarPanel):
* UserInterface/Views/RulesStyleDetailsPanel.js:
(WebInspector.RulesStyleDetailsPanel.prototype.refresh.addNewRuleButton):
(WebInspector.RulesStyleDetailsPanel.prototype.refresh.insertMediaOrInheritanceLabel):
* UserInterface/Views/SearchResultTreeElement.js:
(WebInspector.SearchResultTreeElement.truncateAndHighlightTitle):
* UserInterface/Views/SyntaxHighlightingSupport.js:
(.appendText):
(WebInspector.syntaxHighlightStringAsDocumentFragment):
* UserInterface/Views/TimelineDataGridNode.js:
(WebInspector.TimelineDataGridNode.prototype.createCellContent):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@187402 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/DOMUtilities.js
Source/WebInspectorUI/UserInterface/Base/Main.js
Source/WebInspectorUI/UserInterface/Models/Breakpoint.js
Source/WebInspectorUI/UserInterface/Views/BoxModelDetailsSectionRow.js
Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js
Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/ChartDetailsSectionRow.js
Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js
Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js
Source/WebInspectorUI/UserInterface/Views/DataGrid.js
Source/WebInspectorUI/UserInterface/Views/DebuggerDashboardView.js
Source/WebInspectorUI/UserInterface/Views/EventListenerSectionGroup.js
Source/WebInspectorUI/UserInterface/Views/FormattedValue.js
Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js
Source/WebInspectorUI/UserInterface/Views/ResourceDetailsSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js
Source/WebInspectorUI/UserInterface/Views/SearchResultTreeElement.js
Source/WebInspectorUI/UserInterface/Views/SyntaxHighlightingSupport.js
Source/WebInspectorUI/UserInterface/Views/TimelineDataGridNode.js

index 7cabc9b..7dbba3c 100644 (file)
@@ -1,3 +1,68 @@
+2015-07-25  Nikita Vasilyev  <nvasilyev@apple.com>
+
+        Web Inspector: Start using Node.prototype.append
+        https://bugs.webkit.org/show_bug.cgi?id=147301
+
+        Convert all instances of element.appendChild(document.createTextNode(aString))
+        to element.append(aString).
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Base/DOMUtilities.js:
+        * UserInterface/Base/Main.js:
+        (WebInspector.linkifyLocation):
+        (WebInspector.linkifyStringAsFragmentWithCustomLinkifier):
+        * UserInterface/Models/Breakpoint.js:
+        (WebInspector.Breakpoint.prototype._editBreakpointPopoverContentElement):
+        * UserInterface/Views/BoxModelDetailsSectionRow.js:
+        (WebInspector.BoxModelDetailsSectionRow.prototype._updateMetrics):
+        * UserInterface/Views/CSSStyleDeclarationSection.js:
+        (WebInspector.CSSStyleDeclarationSection.prototype.refresh):
+        * UserInterface/Views/CSSStyleDetailsSidebarPanel.js:
+        (WebInspector.CSSStyleDetailsSidebarPanel):
+        * UserInterface/Views/ChartDetailsSectionRow.js:
+        (WebInspector.ChartDetailsSectionRow.prototype._createLegendItem):
+        * UserInterface/Views/ConsoleMessageView.js:
+        (WebInspector.ConsoleMessageView.prototype._appendMessageTextAndArguments):
+        (WebInspector.ConsoleMessageView.prototype._appendFormattedArguments):
+        * UserInterface/Views/DOMNodeDetailsSidebarPanel.js:
+        (WebInspector.DOMNodeDetailsSidebarPanel.prototype._refreshAccessibility.accessibilityPropertiesCallback):
+        (WebInspector.DOMNodeDetailsSidebarPanel.prototype._refreshAccessibility):
+        * UserInterface/Views/DOMTreeElement.js:
+        (WebInspector.DOMTreeElement.prototype._insertInLastAttributePosition):
+        (WebInspector.DOMTreeElement.prototype._buildAttributeDOM):
+        (WebInspector.DOMTreeElement.prototype._buildTagDOM):
+        (WebInspector.DOMTreeElement.prototype._nodeTitleInfo):
+        defaultElement variable is unused, remove it.
+
+        * UserInterface/Views/DataGrid.js:
+        (WebInspector.DataGridNode.prototype.createCell.get if):
+        (WebInspector.DataGridNode.prototype.createCell):
+        * UserInterface/Views/DebuggerDashboardView.js:
+        (WebInspector.DebuggerDashboardView.prototype._rebuildLocation):
+        * UserInterface/Views/EventListenerSectionGroup.js:
+        (WebInspector.EventListenerSectionGroup.prototype._functionTextOrLink):
+        (WebInspector.EventListenerSectionGroup):
+        * UserInterface/Views/FormattedValue.js:
+        (WebInspector.FormattedValue.createLinkifiedElementString):
+        (WebInspector.FormattedValue.createElementForNodePreview):
+        * UserInterface/Views/ObjectPreviewView.js:
+        (WebInspector.ObjectPreviewView.prototype._appendEntryPreviews):
+        (WebInspector.ObjectPreviewView.prototype._appendPropertyPreviews):
+        * UserInterface/Views/ResourceDetailsSidebarPanel.js:
+        (WebInspector.ResourceDetailsSidebarPanel.prototype._refreshRequestDataSection):
+        (WebInspector.ResourceDetailsSidebarPanel):
+        * UserInterface/Views/RulesStyleDetailsPanel.js:
+        (WebInspector.RulesStyleDetailsPanel.prototype.refresh.addNewRuleButton):
+        (WebInspector.RulesStyleDetailsPanel.prototype.refresh.insertMediaOrInheritanceLabel):
+        * UserInterface/Views/SearchResultTreeElement.js:
+        (WebInspector.SearchResultTreeElement.truncateAndHighlightTitle):
+        * UserInterface/Views/SyntaxHighlightingSupport.js:
+        (.appendText):
+        (WebInspector.syntaxHighlightStringAsDocumentFragment):
+        * UserInterface/Views/TimelineDataGridNode.js:
+        (WebInspector.TimelineDataGridNode.prototype.createCellContent):
+
 2015-07-24  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Add custom parameter lists for new DOM append/prepend/before/after/replaceWith methods
index dcaff4e..065549a 100644 (file)
@@ -92,7 +92,7 @@ WebInspector.linkifyNodeReference = function(node)
     var displayName = WebInspector.displayNameForNode(node);
 
     var link = document.createElement("span");
-    link.appendChild(document.createTextNode(displayName));
+    link.append(displayName);
     link.setAttribute("role", "link");
     link.className = "node-link";
     link.title = displayName;
index b4ebf0f..da1d7d3 100644 (file)
@@ -1814,7 +1814,7 @@ WebInspector.linkifyLocation = function(url, lineNumber, columnNumber, className
         anchor.lineNumber = lineNumber;
         if (className)
             anchor.className = className;
-        anchor.appendChild(document.createTextNode(WebInspector.displayNameForURL(url) + ":" + lineNumber));
+        anchor.append(WebInspector.displayNameForURL(url) + ":" + lineNumber);
         return anchor;
     }
 
@@ -1883,7 +1883,7 @@ WebInspector.linkifyStringAsFragmentWithCustomLinkifier = function(string, linki
         linkString = linkString[0];
         var linkIndex = string.indexOf(linkString);
         var nonLink = string.substring(0, linkIndex);
-        container.appendChild(document.createTextNode(nonLink));
+        container.append(nonLink);
 
         var title = linkString;
         var realURL = (linkString.startsWith("www.") ? "http://" + linkString : linkString);
@@ -1897,7 +1897,7 @@ WebInspector.linkifyStringAsFragmentWithCustomLinkifier = function(string, linki
     }
 
     if (string)
-        container.appendChild(document.createTextNode(string));
+        container.append(string);
 
     return container;
 };
index 2020ac8..dac86b9 100644 (file)
@@ -396,7 +396,7 @@ WebInspector.Breakpoint = class Breakpoint extends WebInspector.Object
         var checkboxLabel = document.createElement("label");
         checkboxLabel.className = "toggle";
         checkboxLabel.appendChild(checkboxElement);
-        checkboxLabel.appendChild(document.createTextNode(this._sourceCodeLocation.displayLocationString()));
+        checkboxLabel.append(this._sourceCodeLocation.displayLocationString());
 
         var table = document.createElement("table");
 
index 5088057..43be6e2 100644 (file)
@@ -216,10 +216,7 @@ WebInspector.BoxModelDetailsSectionRow = class BoxModelDetailsSectionRow extends
             if (name === "content") {
                 var widthElement = createContentAreaWidthElement.call(this, style);
                 var heightElement = createContentAreaHeightElement.call(this, style);
-
-                boxElement.appendChild(widthElement);
-                boxElement.appendChild(document.createTextNode(" \u00D7 "));
-                boxElement.appendChild(heightElement);
+                boxElement.append(widthElement, " \u00D7 ", heightElement);
             } else {
                 var suffix = (name === "border" ? "-width" : "");
 
index 585857a..0c6f352 100644 (file)
@@ -178,7 +178,7 @@ WebInspector.CSSStyleDeclarationSection.prototype = {
         this._originElement.removeChildren();
         this._selectorElements = [];
 
-        this._originElement.appendChild(document.createTextNode(" \u2014 "));
+        this._originElement.append(" \u2014 ");
 
         function appendSelector(selector, matched)
         {
@@ -231,7 +231,7 @@ WebInspector.CSSStyleDeclarationSection.prototype = {
                 for (var i = 0; i < selectors.length; ++i) {
                     appendSelector.call(this, selectors[i], alwaysMatch || matchedSelectorIndices.includes(i));
                     if (i < selectors.length - 1)
-                        this._selectorElement.appendChild(document.createTextNode(", "));
+                        this._selectorElement.append(", ");
                 }
             } else
                 appendSelectorTextKnownToMatch.call(this, this._style.ownerRule.selectorText);
@@ -261,19 +261,19 @@ WebInspector.CSSStyleDeclarationSection.prototype = {
 
                 console.assert(originString);
                 if (originString)
-                    this._originElement.appendChild(document.createTextNode(originString));
+                    this._originElement.append(originString);
             }
 
             break;
 
         case WebInspector.CSSStyleDeclaration.Type.Inline:
             appendSelectorTextKnownToMatch.call(this, WebInspector.displayNameForNode(this._style.node));
-            this._originElement.appendChild(document.createTextNode(WebInspector.UIString("Style Attribute")));
+            this._originElement.append(WebInspector.UIString("Style Attribute"));
             break;
 
         case WebInspector.CSSStyleDeclaration.Type.Attribute:
             appendSelectorTextKnownToMatch.call(this, WebInspector.displayNameForNode(this._style.node));
-            this._originElement.appendChild(document.createTextNode(WebInspector.UIString("HTML Attributes")));
+            this._originElement.append(WebInspector.UIString("HTML Attributes"));
             break;
         }
     },
index ac364c7..e73315d 100644 (file)
@@ -56,7 +56,7 @@ WebInspector.CSSStyleDetailsSidebarPanel = class CSSStyleDetailsSidebarPanel ext
                 this._forcedPseudoClassCheckboxes[pseudoClass] = checkboxElement;
 
                 labelElement.appendChild(checkboxElement);
-                labelElement.appendChild(document.createTextNode(label));
+                labelElement.append(label);
 
                 if (!groupElement || groupElement.children.length === 2) {
                     groupElement = document.createElement("div");
index 4114857..7266171 100644 (file)
@@ -124,8 +124,7 @@ WebInspector.ChartDetailsSectionRow = class ChartDetailsSectionRow extends WebIn
 
         var labelElement = document.createElement("div");
         labelElement.className = "label";
-        labelElement.appendChild(colorSwatchElement);
-        labelElement.appendChild(document.createTextNode(item.label));
+        labelElement.append(colorSwatchElement, item.label);
 
         var valueElement = document.createElement("div");
         valueElement.className = "value";
index 81a6eb4..a3ba537 100644 (file)
@@ -228,7 +228,7 @@ WebInspector.ConsoleMessageView = class ConsoleMessageView extends WebInspector.
             switch (this._message.type) {
             case WebInspector.ConsoleMessage.MessageType.Trace:
                 // FIXME: We should use a better string then console.trace.
-                element.appendChild(document.createTextNode("console.trace()"));
+                element.append("console.trace()");
                 break;
 
             case WebInspector.ConsoleMessage.MessageType.Assert:
@@ -256,7 +256,7 @@ WebInspector.ConsoleMessageView = class ConsoleMessageView extends WebInspector.
             case WebInspector.ConsoleMessage.MessageType.StartGroup:
             case WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed:
                 var groupName = this._message.messageText || WebInspector.UIString("Group");
-                element.appendChild(document.createTextNode(groupName));
+                element.append(groupName);
                 this._extraParameters = null;
                 break;
 
@@ -430,7 +430,7 @@ WebInspector.ConsoleMessageView = class ConsoleMessageView extends WebInspector.
             this._extraParameters = parameters;
         } else {
             var defaultMessage = WebInspector.UIString("No message");
-            builderElement.appendChild(document.createTextNode(defaultMessage));
+            builderElement.append(defaultMessage);
         }
 
         // Trailing parameters.
@@ -459,7 +459,7 @@ WebInspector.ConsoleMessageView = class ConsoleMessageView extends WebInspector.
                     this._extraParameters = null;
             } else {
                 // Multiple objects. Show an indicator.
-                builderElement.appendChild(document.createTextNode(" "));
+                builderElement.append(" ");
                 var enclosedElement = builderElement.appendChild(document.createElement("span"));
                 enclosedElement.classList.add("console-message-enclosed");
                 enclosedElement.textContent = "(" + parameters.length + ")";
index 81db200..9a9919a 100644 (file)
@@ -416,10 +416,10 @@ WebInspector.DOMNodeDetailsSidebarPanel = class DOMNodeDetailsSidebarPanel exten
                         liveRegionStatusNode = document.createElement("div");
                         liveRegionStatusNode.className = "value-with-clarification";
                         liveRegionStatusNode.setAttribute("role", "text");
-                        liveRegionStatusNode.appendChild(document.createTextNode(liveRegionStatus));
+                        liveRegionStatusNode.append(liveRegionStatus);
                         var clarificationNode = document.createElement("div");
                         clarificationNode.className = "clarification";
-                        clarificationNode.appendChild(document.createTextNode(WebInspector.UIString("Region announced in its entirety.")));
+                        clarificationNode.append(WebInspector.UIString("Region announced in its entirety."));
                         liveRegionStatusNode.appendChild(clarificationNode);
                     }
                 }
index 26cf17d..7088b39 100644 (file)
@@ -562,9 +562,7 @@ WebInspector.DOMTreeElement = class DOMTreeElement extends WebInspector.TreeElem
         else {
             var nodeName = tag.textContent.match(/^<(.*?)>$/)[1];
             tag.textContent = "";
-            tag.appendChild(document.createTextNode("<" + nodeName));
-            tag.appendChild(node);
-            tag.appendChild(document.createTextNode(">"));
+            tag.append("<" + nodeName, node, ">");
         }
 
         this.updateSelection();
@@ -1045,7 +1043,7 @@ WebInspector.DOMTreeElement = class DOMTreeElement extends WebInspector.TreeElem
         attrNameElement.textContent = name;
 
         if (hasText)
-            attrSpanElement.appendChild(document.createTextNode("=\u200B\""));
+            attrSpanElement.append("=\u200B\"");
 
         if (name === "src" || name === "href") {
             var baseURL = node.ownerDocument ? node.ownerDocument.documentURL : null;
@@ -1073,7 +1071,7 @@ WebInspector.DOMTreeElement = class DOMTreeElement extends WebInspector.TreeElem
         }
 
         if (hasText)
-            attrSpanElement.appendChild(document.createTextNode("\""));
+            attrSpanElement.append("\"");
     }
 
     _buildTagDOM(parentElement, tagName, isClosingTag, isDistinctTreeElement)
@@ -1085,19 +1083,19 @@ WebInspector.DOMTreeElement = class DOMTreeElement extends WebInspector.TreeElem
         if (node.isInShadowTree())
             classes.push("shadow");
         var tagElement = parentElement.createChild("span", classes.join(" "));
-        tagElement.appendChild(document.createTextNode("<"));
+        tagElement.append("<");
         var tagNameElement = tagElement.createChild("span", isClosingTag ? "" : "html-tag-name");
         tagNameElement.textContent = (isClosingTag ? "/" : "") + tagName;
         if (!isClosingTag && node.hasAttributes()) {
             var attributes = node.attributes();
             for (var i = 0; i < attributes.length; ++i) {
                 var attr = attributes[i];
-                tagElement.appendChild(document.createTextNode(" "));
+                tagElement.append(" ");
                 this._buildAttributeDOM(tagElement, attr.name, attr.value, node);
             }
         }
-        tagElement.appendChild(document.createTextNode(">"));
-        parentElement.appendChild(document.createTextNode("\u200B"));
+        tagElement.append(">");
+        parentElement.append("\u200B");
     }
 
     _nodeTitleInfo()
@@ -1144,7 +1142,7 @@ WebInspector.DOMTreeElement = class DOMTreeElement extends WebInspector.TreeElem
                     if (this.hasChildren) {
                         var textNodeElement = info.titleDOM.createChild("span", "html-text-node");
                         textNodeElement.textContent = "\u2026";
-                        info.titleDOM.appendChild(document.createTextNode("\u200B"));
+                        info.titleDOM.append("\u200B");
                     }
                     this._buildTagDOM(info.titleDOM, tagName, true, false);
                 }
@@ -1163,7 +1161,7 @@ WebInspector.DOMTreeElement = class DOMTreeElement extends WebInspector.TreeElem
                     else
                         textNodeElement.textContent = textChild.nodeValue();
 
-                    info.titleDOM.appendChild(document.createTextNode("\u200B"));
+                    info.titleDOM.append("\u200B");
 
                     this._buildTagDOM(info.titleDOM, tagName, true, false);
                     info.hasChildren = false;
@@ -1178,37 +1176,37 @@ WebInspector.DOMTreeElement = class DOMTreeElement extends WebInspector.TreeElem
                     var newNode = info.titleDOM.createChild("span", "html-text-node large");
                     newNode.appendChild(WebInspector.syntaxHighlightStringAsDocumentFragment(trimedNodeValue(), "text/css"));
                 } else {
-                    info.titleDOM.appendChild(document.createTextNode("\""));
+                    info.titleDOM.append("\"");
                     var textNodeElement = info.titleDOM.createChild("span", "html-text-node");
                     textNodeElement.textContent = node.nodeValue();
-                    info.titleDOM.appendChild(document.createTextNode("\""));
+                    info.titleDOM.append("\"");
                 }
                 break;
 
             case Node.COMMENT_NODE:
                 var commentElement = info.titleDOM.createChild("span", "html-comment");
-                commentElement.appendChild(document.createTextNode("<!--" + node.nodeValue() + "-->"));
+                commentElement.append("<!--" + node.nodeValue() + "-->");
                 break;
 
             case Node.DOCUMENT_TYPE_NODE:
                 var docTypeElement = info.titleDOM.createChild("span", "html-doctype");
-                docTypeElement.appendChild(document.createTextNode("<!DOCTYPE " + node.nodeName()));
+                docTypeElement.append("<!DOCTYPE " + node.nodeName());
                 if (node.publicId) {
-                    docTypeElement.appendChild(document.createTextNode(" PUBLIC \"" + node.publicId + "\""));
+                    docTypeElement.append(" PUBLIC \"" + node.publicId + "\"");
                     if (node.systemId)
-                        docTypeElement.appendChild(document.createTextNode(" \"" + node.systemId + "\""));
+                        docTypeElement.append(" \"" + node.systemId + "\"");
                 } else if (node.systemId)
-                    docTypeElement.appendChild(document.createTextNode(" SYSTEM \"" + node.systemId + "\""));
+                    docTypeElement.append(" SYSTEM \"" + node.systemId + "\"");
 
                 if (node.internalSubset)
-                    docTypeElement.appendChild(document.createTextNode(" [" + node.internalSubset + "]"));
+                    docTypeElement.append(" [" + node.internalSubset + "]");
 
-                docTypeElement.appendChild(document.createTextNode(">"));
+                docTypeElement.append(">");
                 break;
 
             case Node.CDATA_SECTION_NODE:
                 var cdataElement = info.titleDOM.createChild("span", "html-text-node");
-                cdataElement.appendChild(document.createTextNode("<![CDATA[" + node.nodeValue() + "]]>"));
+                cdataElement.append("<![CDATA[" + node.nodeValue() + "]]>");
                 break;
 
             case Node.PROCESSING_INSTRUCTION_NODE:
@@ -1216,11 +1214,11 @@ WebInspector.DOMTreeElement = class DOMTreeElement extends WebInspector.TreeElem
                 var data = node.nodeValue();
                 var dataString = data.length ? " " + data : "";
                 var title = "<?" + node.nodeNameInCorrectCase() + dataString + "?>";
-                processingInstructionElement.appendChild(document.createTextNode(title));
+                processingInstructionElement.append(title);
                 break;
 
             default:
-                var defaultElement = info.titleDOM.appendChild(document.createTextNode(node.nodeNameInCorrectCase().collapseWhitespace()));
+                info.titleDOM.append(node.nodeNameInCorrectCase().collapseWhitespace());
         }
 
         return info;
index a7fa134..c8b9e0e 100644 (file)
@@ -1578,7 +1578,7 @@ WebInspector.DataGridNode.prototype = {
 
         var div = cellElement.createChild("div");
         var content = this.createCellContent(columnIdentifier, cellElement);
-        div.appendChild(content instanceof Node ? content : document.createTextNode(content));
+        div.append(content);
 
         if (columnIdentifier === this.dataGrid.disclosureColumnIdentifier) {
             cellElement.classList.add("disclosure");
index aba26ed..bacf874 100644 (file)
@@ -84,7 +84,7 @@ WebInspector.DebuggerDashboardView = class DebuggerDashboardView extends WebInsp
         iconElement.appendChild(iconImageElement);
 
         var nameElement = document.createElement("div");
-        nameElement.appendChild(document.createTextNode(functionName));
+        nameElement.append(functionName);
         nameElement.classList.add("function-name");
         this._locationElement.appendChild(nameElement);
 
index 18eca78..7ce811c 100644 (file)
@@ -95,8 +95,7 @@ WebInspector.EventListenerSectionGroup = class EventListenerSectionGroup extends
             return linkElement;
 
         var fragment = document.createDocumentFragment();
-        fragment.appendChild(linkElement);
-        fragment.appendChild(document.createTextNode(functionName));
+        fragment.append(linkElement, functionName);
         return fragment;
     }
 };
index 2cf3677..1cfffe0 100644 (file)
@@ -39,9 +39,7 @@ WebInspector.FormattedValue.createLinkifiedElementString = function(string)
 {
     var span = document.createElement("span");
     span.className = "formatted-string";
-    span.appendChild(document.createTextNode("\""));
-    span.appendChild(WebInspector.linkifyStringAsFragment(string.replace(/"/g, "\\\"")));
-    span.appendChild(document.createTextNode("\""));
+    span.append("\"", WebInspector.linkifyStringAsFragment(string.replace(/"/g, "\\\"")), "\"");
     return span;
 };
 
@@ -102,27 +100,27 @@ WebInspector.FormattedValue.createElementForNodePreview = function(preview)
 
     var tag = document.createElement("span");
     tag.className = "html-tag";
-    tag.appendChild(document.createTextNode("<"));
+    tag.append("<");
 
     var tagName = tag.appendChild(document.createElement("span"));
     tagName.className = "html-tag-name";
     tagName.textContent = matches[1];
 
     if (matches[2]) {
-        tag.appendChild(document.createTextNode(" "));
+        tag.append(" ");
         var attribute = tag.appendChild(document.createElement("span"));
         attribute.className = "html-attribute";
         var attributeName = attribute.appendChild(document.createElement("span"));
         attributeName.className = "html-attribute-name";
         attributeName.textContent = matches[2];
-        attribute.appendChild(document.createTextNode("=\""));
+        attribute.append("=\"");
         var attributeValue = attribute.appendChild(document.createElement("span"));
         attributeValue.className = "html-attribute-value";
         attributeValue.textContent = matches[3];
-        attribute.appendChild(document.createTextNode("\""));
+        attribute.append("\"");
     }
 
-    tag.appendChild(document.createTextNode(">"));
+    tag.append(">");
     span.appendChild(tag);
 
     return span;
index 9d76322..5d82ba0 100644 (file)
@@ -152,18 +152,18 @@ WebInspector.ObjectPreviewView = class ObjectPreviewView extends WebInspector.Ob
 
         var isIterator = preview.subtype === "iterator";
 
-        element.appendChild(document.createTextNode(isIterator ? "[" : "{"));
+        element.append(isIterator ? "[" : "{");
 
         var limit = Math.min(preview.collectionEntryPreviews.length, this._numberOfPropertiesToShowInMode());
         for (var i = 0; i < limit; ++i) {
             if (i > 0)
-                element.appendChild(document.createTextNode(", "));
+                element.append(", ");
 
             var keyPreviewLossless = true;
             var entry = preview.collectionEntryPreviews[i];
             if (entry.keyPreview) {
                 keyPreviewLossless = this._appendPreview(element, entry.keyPreview);
-                element.appendChild(document.createTextNode(" => "));
+                element.append(" => ");
             }
 
             var valuePreviewLossless = this._appendPreview(element, entry.valuePreview);
@@ -178,8 +178,8 @@ WebInspector.ObjectPreviewView = class ObjectPreviewView extends WebInspector.Ob
         }
 
         if (overflow)
-            element.appendChild(document.createTextNode(", \u2026"));
-        element.appendChild(document.createTextNode(isIterator ? "]" : "}"));
+            element.append(", \u2026");
+        element.append(isIterator ? "]" : "}");
 
         return lossless;
     }
@@ -200,7 +200,7 @@ WebInspector.ObjectPreviewView = class ObjectPreviewView extends WebInspector.Ob
         // FIXME: Array previews should have better sparse support: (undefined × 10).
         var isArray = preview.subtype === "array";
 
-        element.appendChild(document.createTextNode(isArray ? "[" : "{"));
+        element.append(isArray ? "[" : "{");
 
         var numberAdded = 0;
         var limit = this._numberOfPropertiesToShowInMode();
@@ -216,13 +216,13 @@ WebInspector.ObjectPreviewView = class ObjectPreviewView extends WebInspector.Ob
                 continue;
 
             if (numberAdded++ > 0)
-                element.appendChild(document.createTextNode(", "));
+                element.append(", ");
 
             if (!isArray || property.name != i) {
                 var nameElement = element.appendChild(document.createElement("span"));
                 nameElement.className = "name";
                 nameElement.textContent = property.name;
-                element.appendChild(document.createTextNode(": "));
+                element.append(": ");
             }
 
             if (property.valuePreview)
@@ -239,8 +239,8 @@ WebInspector.ObjectPreviewView = class ObjectPreviewView extends WebInspector.Ob
         }
 
         if (overflow)
-            element.appendChild(document.createTextNode(", \u2026"));
-        element.appendChild(document.createTextNode(isArray ? "]" : "}"));
+            element.append(", \u2026");
+        element.append(isArray ? "]" : "}");
 
         return lossless;
     }
index 1719983..274d10d 100644 (file)
@@ -459,7 +459,7 @@ WebInspector.ResourceDetailsSidebarPanel = class ResourceDetailsSidebarPanel ext
 
         var dataValue = document.createDocumentFragment();
 
-        dataValue.appendChild(document.createTextNode(sizeValue));
+        dataValue.append(sizeValue);
 
         var goToButton = dataValue.appendChild(WebInspector.createGoToArrowButton());
         goToButton.addEventListener("click", this._goToRequestDataClicked.bind(this));
index 8baa12d..a4f3687 100644 (file)
@@ -170,8 +170,7 @@ WebInspector.RulesStyleDetailsPanel = class RulesStyleDetailsPanel extends WebIn
                 newRuleButton.className = "new-rule";
                 newRuleButton.addEventListener("click", this._newRuleClicked.bind(this));
 
-                newRuleButton.appendChild(document.createElement("img"));
-                newRuleButton.appendChild(document.createTextNode(WebInspector.UIString("New Rule")));
+                newRuleButton.append(document.createElement("img"), WebInspector.UIString("New Rule"));
 
                 newDOMFragment.appendChild(newRuleButton);
             }
@@ -217,13 +216,10 @@ WebInspector.RulesStyleDetailsPanel = class RulesStyleDetailsPanel extends WebIn
 
                     var mediaLabel = document.createElement("div");
                     mediaLabel.className = "label";
-                    mediaLabel.appendChild(prefixElement);
-                    mediaLabel.appendChild(document.createTextNode(media.text));
+                    mediaLabel.append(prefixElement, media.text);
 
-                    if (media.sourceCodeLocation) {
-                        mediaLabel.appendChild(document.createTextNode(" \u2014 "));
-                        mediaLabel.appendChild(WebInspector.createSourceCodeLocationLink(media.sourceCodeLocation, true));
-                    }
+                    if (media.sourceCodeLocation)
+                        mediaLabel.append(" \u2014 ", WebInspector.createSourceCodeLocationLink(media.sourceCodeLocation, true));
 
                     newDOMFragment.appendChild(mediaLabel);
 
@@ -240,8 +236,7 @@ WebInspector.RulesStyleDetailsPanel = class RulesStyleDetailsPanel extends WebIn
 
                     var mediaLabel = document.createElement("div");
                     mediaLabel.className = "label";
-                    mediaLabel.appendChild(prefixElement);
-                    mediaLabel.appendChild(document.createTextNode("all"));
+                    mediaLabel.append(prefixElement, "all");
 
                     newDOMFragment.appendChild(mediaLabel);
                     hasMediaOrInherited.push(mediaLabel);
index 144ef28..1a617df 100644 (file)
@@ -64,14 +64,14 @@ WebInspector.SearchResultTreeElement = class SearchResultTreeElement extends Web
 
         var highlightedTitle = document.createDocumentFragment();
 
-        highlightedTitle.appendChild(document.createTextNode(modifiedTitle.substring(0, searchTermIndex)));
+        highlightedTitle.append(modifiedTitle.substring(0, searchTermIndex));
 
         var highlightSpan = document.createElement("span");
         highlightSpan.className = "highlighted";
-        highlightSpan.appendChild(document.createTextNode(modifiedTitle.substring(searchTermIndex, searchTermIndex + searchTerm.length)));
+        highlightSpan.append(modifiedTitle.substring(searchTermIndex, searchTermIndex + searchTerm.length));
         highlightedTitle.appendChild(highlightSpan);
 
-        highlightedTitle.appendChild(document.createTextNode(modifiedTitle.substring(searchTermIndex + searchTerm.length)));
+        highlightedTitle.append(modifiedTitle.substring(searchTermIndex + searchTerm.length));
 
         return highlightedTitle;
     }
index 1e98e26..5181887 100644 (file)
@@ -32,7 +32,7 @@ WebInspector.syntaxHighlightStringAsDocumentFragment = function(string, mimeType
     function appendText(text, style)
     {
         if (!style) {
-            resultFragment.appendChild(document.createTextNode(text));
+            resultFragment.append(text);
             return;
         }
 
index 3faa5dd..9832f51 100644 (file)
@@ -187,7 +187,7 @@ WebInspector.TimelineDataGridNode.prototype = {
                     // Show the function name and icon.
                     cell.classList.add(WebInspector.CallFrameView.FunctionIconStyleClassName);
 
-                    fragment.appendChild(document.createTextNode(functionName));
+                    fragment.append(functionName);
 
                     var subtitleElement = document.createElement("span");
                     subtitleElement.className = WebInspector.LayoutTimelineDataGridNode.SubtitleStyleClassName;
@@ -201,9 +201,8 @@ WebInspector.TimelineDataGridNode.prototype = {
 
             var icon = document.createElement("div");
             icon.className = WebInspector.LayoutTimelineDataGridNode.IconStyleClassName;
-            fragment.appendChild(icon);
 
-            fragment.appendChild(document.createTextNode(functionName));
+            fragment.append(icon, functionName);
 
             return fragment;
         }