Web Inspector: Pass multiple arguments to classList.add and classList.remove
authornvasilyev@apple.com <nvasilyev@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 19 Apr 2015 04:20:46 +0000 (04:20 +0000)
committernvasilyev@apple.com <nvasilyev@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 19 Apr 2015 04:20:46 +0000 (04:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=143914

classList.add and classList.remove can accept multiple arguments, use that.

Reviewed by Timothy Hatcher.

* UserInterface/Base/Main.js:
(WebInspector.updateDockedState):
* UserInterface/Views/DOMTreeDataGrid.js:
(WebInspector.DOMTreeDataGrid):
* UserInterface/Views/DOMTreeOutline.js:
(WebInspector.DOMTreeOutline):
* UserInterface/Views/DataGrid.js:
(WebInspector.DataGridNode.prototype.set hasChildren):
* UserInterface/Views/DatabaseContentView.js:
(WebInspector.DatabaseContentView):
* UserInterface/Views/DetailsSection.js:
(WebInspector.DetailsSection):
* UserInterface/Views/DetailsSectionPropertiesRow.js:
(WebInspector.DetailsSectionPropertiesRow):
* UserInterface/Views/GeneralTreeElement.js:
(WebInspector.GeneralTreeElement.prototype.set classNames):
* UserInterface/Views/NavigationItem.js:
(WebInspector.NavigationItem):
* UserInterface/Views/ResourceContentView.js:
(WebInspector.ResourceContentView):
* UserInterface/Views/ResourceTimelineDataGridNode.js:
(WebInspector.ResourceTimelineDataGridNode.prototype.createCellContent):
* UserInterface/Views/Sidebar.js:
(WebInspector.Sidebar):
* UserInterface/Views/SidebarPanel.js:
(WebInspector.SidebarPanel):
* UserInterface/Views/SourceCodeTextEditor.js:
* UserInterface/Views/TextEditor.js:
(WebInspector.TextEditor):
* UserInterface/Views/TimelineRuler.js:

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

17 files changed:
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/Main.js
Source/WebInspectorUI/UserInterface/Views/DOMTreeDataGrid.js
Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js
Source/WebInspectorUI/UserInterface/Views/DataGrid.js
Source/WebInspectorUI/UserInterface/Views/DatabaseContentView.js
Source/WebInspectorUI/UserInterface/Views/DetailsSection.js
Source/WebInspectorUI/UserInterface/Views/DetailsSectionPropertiesRow.js
Source/WebInspectorUI/UserInterface/Views/GeneralTreeElement.js
Source/WebInspectorUI/UserInterface/Views/NavigationItem.js
Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js
Source/WebInspectorUI/UserInterface/Views/ResourceTimelineDataGridNode.js
Source/WebInspectorUI/UserInterface/Views/Sidebar.js
Source/WebInspectorUI/UserInterface/Views/SidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js
Source/WebInspectorUI/UserInterface/Views/TextEditor.js
Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js

index 81f525d..d3f8f96 100644 (file)
@@ -1,5 +1,45 @@
 2015-04-18  Nikita Vasilyev  <nvasilyev@apple.com>
 
+        Web Inspector: Pass multiple arguments to classList.add and classList.remove
+        https://bugs.webkit.org/show_bug.cgi?id=143914
+
+        classList.add and classList.remove can accept multiple arguments, use that.
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Base/Main.js:
+        (WebInspector.updateDockedState):
+        * UserInterface/Views/DOMTreeDataGrid.js:
+        (WebInspector.DOMTreeDataGrid):
+        * UserInterface/Views/DOMTreeOutline.js:
+        (WebInspector.DOMTreeOutline):
+        * UserInterface/Views/DataGrid.js:
+        (WebInspector.DataGridNode.prototype.set hasChildren):
+        * UserInterface/Views/DatabaseContentView.js:
+        (WebInspector.DatabaseContentView):
+        * UserInterface/Views/DetailsSection.js:
+        (WebInspector.DetailsSection):
+        * UserInterface/Views/DetailsSectionPropertiesRow.js:
+        (WebInspector.DetailsSectionPropertiesRow):
+        * UserInterface/Views/GeneralTreeElement.js:
+        (WebInspector.GeneralTreeElement.prototype.set classNames):
+        * UserInterface/Views/NavigationItem.js:
+        (WebInspector.NavigationItem):
+        * UserInterface/Views/ResourceContentView.js:
+        (WebInspector.ResourceContentView):
+        * UserInterface/Views/ResourceTimelineDataGridNode.js:
+        (WebInspector.ResourceTimelineDataGridNode.prototype.createCellContent):
+        * UserInterface/Views/Sidebar.js:
+        (WebInspector.Sidebar):
+        * UserInterface/Views/SidebarPanel.js:
+        (WebInspector.SidebarPanel):
+        * UserInterface/Views/SourceCodeTextEditor.js:
+        * UserInterface/Views/TextEditor.js:
+        (WebInspector.TextEditor):
+        * UserInterface/Views/TimelineRuler.js:
+
+2015-04-18  Nikita Vasilyev  <nvasilyev@apple.com>
+
         Web Inspector: Make prototype pill’s background semi-transparent
         https://bugs.webkit.org/show_bug.cgi?id=143928
 
index 15a7f26..691ec09 100644 (file)
@@ -457,27 +457,19 @@ WebInspector.updateDockedState = function(side)
     this._ignoreToolbarModeDidChangeEvents = true;
 
     if (side === "bottom") {
-        document.body.classList.add("docked");
-        document.body.classList.add("bottom");
-
-        document.body.classList.remove("window-inactive");
-        document.body.classList.remove("right");
+        document.body.classList.add("docked", "bottom");
+        document.body.classList.remove("window-inactive", "right");
 
         this.toolbar.displayMode = this._toolbarDockedBottomDisplayModeSetting.value;
         this.toolbar.sizeMode = this._toolbarDockedBottomSizeModeSetting.value;
     } else if (side === "right") {
-        document.body.classList.add("docked");
-        document.body.classList.add("right");
-
-        document.body.classList.remove("window-inactive");
-        document.body.classList.remove("bottom");
+        document.body.classList.add("docked", "right");
+        document.body.classList.remove("window-inactive", "bottom");
 
         this.toolbar.displayMode = this._toolbarDockedRightDisplayModeSetting.value;
         this.toolbar.sizeMode = this._toolbarDockedRightSizeModeSetting.value;
     } else {
-        document.body.classList.remove("docked");
-        document.body.classList.remove("right");
-        document.body.classList.remove("bottom");
+        document.body.classList.remove("docked", "right", "bottom");
 
         this.toolbar.displayMode = this._toolbarUndockedDisplayModeSetting.value;
         this.toolbar.sizeMode = this._toolbarUndockedSizeModeSetting.value;
index c9031d2..c44c4bf 100644 (file)
@@ -30,8 +30,7 @@ WebInspector.DOMTreeDataGrid = function() {
 
     this._previousHoveredElement = null;
 
-    this.element.classList.add("dom-tree-data-grid");
-    this.element.classList.add("inline");
+    this.element.classList.add("inline", "dom-tree-data-grid");
 
     this.element.addEventListener("mousemove", this._onmousemove.bind(this), false);
     this.element.addEventListener("mouseout", this._onmouseout.bind(this), false);
index f166c2a..452b26c 100644 (file)
@@ -45,8 +45,7 @@ WebInspector.DOMTreeOutline = class DOMTreeOutline extends WebInspector.TreeOutl
         element.addEventListener("drop", this._ondrop.bind(this), false);
         element.addEventListener("dragend", this._ondragend.bind(this), false);
 
-        element.classList.add("dom-tree-outline");
-        element.classList.add(WebInspector.SyntaxHighlightedStyleClassName);
+        element.classList.add("dom-tree-outline", WebInspector.SyntaxHighlightedStyleClassName);
 
         this._includeRootDOMNode = !omitRootDOMNode;
         this._selectEnabled = selectEnabled;
index 9900806..c57e6f9 100644 (file)
@@ -1454,8 +1454,7 @@ WebInspector.DataGridNode.prototype = {
         }
         else
         {
-            this._element.classList.remove("parent");
-            this._element.classList.remove("expanded");
+            this._element.classList.remove("parent", "expanded");
         }
     },
 
index 27ea0d9..a7892bd 100644 (file)
@@ -29,9 +29,7 @@ WebInspector.DatabaseContentView = function(representedObject)
 
     this.database = representedObject;
 
-    this.element.classList.add("storage-view");
-    this.element.classList.add("query");
-    this.element.classList.add("monospace");
+    this.element.classList.add("storage-view", "query", "monospace");
 
     this._promptElement = document.createElement("div");
     this._promptElement.className = "database-query-prompt";
index 9ecdc7c..368cd74 100644 (file)
@@ -32,8 +32,7 @@ WebInspector.DetailsSection = class DetailsSection extends WebInspector.Object
         console.assert(identifier);
 
         this._element = document.createElement("div");
-        this._element.className = WebInspector.DetailsSection.StyleClassName;
-        this._element.classList.add(identifier);
+        this._element.classList.add(identifier, "details-section");
 
         this._headerElement = document.createElement("div");
         this._headerElement.addEventListener("click", this._headerElementClicked.bind(this));
@@ -161,7 +160,6 @@ WebInspector.DetailsSection = class DetailsSection extends WebInspector.Object
     }
 };
 
-WebInspector.DetailsSection.StyleClassName = "details-section";
 WebInspector.DetailsSection.HeaderElementStyleClassName = "header";
 WebInspector.DetailsSection.TitleElementStyleClassName = "title";
 WebInspector.DetailsSection.ContentElementStyleClassName = "content";
index a4bd4ec..6c28008 100644 (file)
@@ -29,8 +29,7 @@ WebInspector.DetailsSectionPropertiesRow = class DetailsSectionPropertiesRow ext
     {
         super(emptyMessage);
 
-        this.element.classList.add("properties");
-        this.element.classList.add(WebInspector.SyntaxHighlightedStyleClassName);
+        this.element.classList.add("properties", WebInspector.SyntaxHighlightedStyleClassName);
 
         this.propertiesSection = propertiesSection;
     }
index 7a15f6d..58c2478 100644 (file)
@@ -77,8 +77,7 @@ WebInspector.GeneralTreeElement = class GeneralTreeElement extends WebInspector.
     set classNames(x)
     {
         if (this._listItemNode && this._classNames) {
-            for (var i = 0; i < this._classNames.length; ++i)
-                this._listItemNode.classList.remove(this._classNames[i]);
+            this._listItemNode.classList.remove(...this._classNames);
         }
 
         if (typeof x === "string")
@@ -87,8 +86,7 @@ WebInspector.GeneralTreeElement = class GeneralTreeElement extends WebInspector.
         this._classNames = x || [];
 
         if (this._listItemNode) {
-            for (var i = 0; i < this._classNames.length; ++i)
-                this._listItemNode.classList.add(this._classNames[i]);
+            this._listItemNode.classList.add(...this._classNames);
         }
     }
 
@@ -222,8 +220,7 @@ WebInspector.GeneralTreeElement = class GeneralTreeElement extends WebInspector.
         this._listItemNode.classList.add("item");
 
         if (this._classNames) {
-            for (var i = 0; i < this._classNames.length; ++i)
-                this._listItemNode.classList.add(this._classNames[i]);
+            this._listItemNode.classList.add(...this._classNames);
         }
 
         if (this._small)
index a312569..3988caf 100644 (file)
@@ -37,10 +37,7 @@ WebInspector.NavigationItem = function(identifier, role, label) {
     if (label)
         this._element.setAttribute("aria-label", label);
 
-    var classNames = this._classNames;
-    for (var i = 0; i < classNames.length; ++i)
-        this._element.classList.add(classNames[i]);
-
+    this._element.classList.add(...this._classNames);
     this._element.navigationItem = this;
 };
 
index 58f7414..4a4f60e 100644 (file)
@@ -32,8 +32,7 @@ WebInspector.ResourceContentView = function(resource, styleClassName)
 
     this._resource = resource;
 
-    this.element.classList.add(WebInspector.ResourceContentView.StyleClassName);
-    this.element.classList.add(styleClassName);
+    this.element.classList.add(styleClassName, "resource");
 
     // Append a spinner while waiting for contentAvailable. The subclasses are responsible for removing
     // the spinner before showing the resource content.
@@ -54,8 +53,6 @@ WebInspector.ResourceContentView = function(resource, styleClassName)
     }
 };
 
-WebInspector.ResourceContentView.StyleClassName = "resource";
-
 WebInspector.ResourceContentView.prototype = {
     constructor: WebInspector.ResourceContentView,
     __proto__: WebInspector.ContentView.prototype,
index 8393357..9f5859f 100644 (file)
@@ -107,8 +107,7 @@ WebInspector.ResourceTimelineDataGridNode.prototype = {
 
         switch (columnIdentifier) {
         case "name":
-            cell.classList.add(WebInspector.ResourceTreeElement.ResourceIconStyleClassName);
-            cell.classList.add(resource.type);
+            cell.classList.add(resource.type, WebInspector.ResourceTreeElement.ResourceIconStyleClassName);
 
             var fragment = document.createDocumentFragment();
 
index 02fd591..4627411 100644 (file)
@@ -33,9 +33,7 @@ WebInspector.Sidebar = class Sidebar extends WebInspector.Object
         this._side = side || WebInspector.Sidebar.Sides.Left;
 
         this._element = element || document.createElement("div");
-        this._element.classList.add("sidebar");
-        this._element.classList.add(WebInspector.Sidebar.CollapsedStyleClassName);
-        this._element.classList.add(this._side);
+        this._element.classList.add("sidebar", this._side, WebInspector.Sidebar.CollapsedStyleClassName);
 
         this._element.setAttribute("role", role || "group");
         if (label)
index 7ce02a2..66f4c33 100644 (file)
@@ -36,8 +36,7 @@ WebInspector.SidebarPanel = class SidebarPanel extends WebInspector.Object
         this._toolbarItem.enabled = false;
 
         this._element = element || document.createElement("div");
-        this._element.classList.add("panel");
-        this._element.classList.add(identifier);
+        this._element.classList.add("panel", identifier);
 
         this._element.setAttribute("role", role || "group");
         this._element.setAttribute("aria-label", label || displayName);
index fbf664d..2c95483 100644 (file)
@@ -840,8 +840,7 @@ WebInspector.SourceCodeTextEditor = class SourceCodeTextEditor extends WebInspec
             return null;
 
         var widgetElement = widget.widgetElement;
-        widgetElement.classList.add("issue-widget");
-        widgetElement.classList.add("inline");
+        widgetElement.classList.add("issue-widget", "inline");
         widgetElement.addEventListener("click", this._handleWidgetClick.bind(this, widget, lineNumber));
 
         this._widgetMap.set(lineNumber, widget);
index 26ee535..1965410 100644 (file)
@@ -30,8 +30,7 @@ WebInspector.TextEditor = class TextEditor extends WebInspector.Object
         super();
 
         this._element = element || document.createElement("div");
-        this._element.classList.add("text-editor");
-        this._element.classList.add(WebInspector.SyntaxHighlightedStyleClassName);
+        this._element.classList.add("text-editor", WebInspector.SyntaxHighlightedStyleClassName);
 
         this._codeMirror = CodeMirror(this.element, {
             readOnly: true,
index a33ec35..c890a63 100644 (file)
@@ -291,8 +291,7 @@ WebInspector.TimelineRuler.prototype = {
         marker.addEventListener(WebInspector.TimelineMarker.Event.TimeChanged, this._timelineMarkerTimeChanged, this);
 
         var markerElement = document.createElement("div");
-        markerElement.classList.add(WebInspector.TimelineRuler.BaseMarkerElementStyleClassName);
-        markerElement.classList.add(marker.type);
+        markerElement.classList.add(marker.type, WebInspector.TimelineRuler.BaseMarkerElementStyleClassName);
 
         this._markerElementMap.set(marker, markerElement);