Bug 1501622 - For consistency, clear innerHTML in SwatchTooltips;r=pbro
authorJulian Descottes <jdescottes@mozilla.com>
Wed, 24 Oct 2018 13:37:17 +0000
changeset 491151 664384a424edde8a0ab46f33f71c169619ec3eba
parent 491150 43ce349e156691358e51bc2dd5d3c048c4a07d74
child 491152 ab0947533e9afba5a0a9e2abd09735bfa3c090a4
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewerspbro
bugs1501622
milestone65.0a1
Bug 1501622 - For consistency, clear innerHTML in SwatchTooltips;r=pbro Depends on D9648 Note that this is not strictly necessary since the set* methods are only called when the Swatch tooltips are built, so they always operate on "new" HTML Tooltips. But since this is not very self explanatory I think it will be less surprising to be on the safe side and clear innerHTML in the methods directly. Differential Revision: https://phabricator.services.mozilla.com/D9649
devtools/client/shared/widgets/tooltip/SwatchColorPickerTooltip.js
devtools/client/shared/widgets/tooltip/SwatchCubicBezierTooltip.js
devtools/client/shared/widgets/tooltip/SwatchFilterTooltip.js
--- a/devtools/client/shared/widgets/tooltip/SwatchColorPickerTooltip.js
+++ b/devtools/client/shared/widgets/tooltip/SwatchColorPickerTooltip.js
@@ -46,16 +46,17 @@ class SwatchColorPickerTooltip extends S
 
   /**
    * Fill the tooltip with a new instance of the spectrum color picker widget
    * initialized with the given color, and return the instance of spectrum
    */
 
   setColorPickerContent(color) {
     const { doc } = this.tooltip;
+    this.tooltip.panel.innerHTML = "";
 
     const container = doc.createElementNS(XHTML_NS, "div");
     container.id = "spectrum-tooltip";
 
     const node = doc.createElementNS(XHTML_NS, "div");
     node.id = "spectrum";
     container.appendChild(node);
 
--- a/devtools/client/shared/widgets/tooltip/SwatchCubicBezierTooltip.js
+++ b/devtools/client/shared/widgets/tooltip/SwatchCubicBezierTooltip.js
@@ -36,16 +36,17 @@ class SwatchCubicBezierTooltip extends S
   /**
    * Fill the tooltip with a new instance of the cubic-bezier widget
    * initialized with the given value, and return a promise that resolves to
    * the instance of the widget
    */
 
   setCubicBezierContent(bezier) {
     const { doc } = this.tooltip;
+    this.tooltip.panel.innerHTML = "";
 
     const container = doc.createElementNS(XHTML_NS, "div");
     container.className = "cubic-bezier-container";
 
     this.tooltip.panel.appendChild(container);
     this.tooltip.setContentSize({ width: 510, height: 370 });
 
     const def = defer();
--- a/devtools/client/shared/widgets/tooltip/SwatchFilterTooltip.js
+++ b/devtools/client/shared/widgets/tooltip/SwatchFilterTooltip.js
@@ -38,16 +38,17 @@ class SwatchFilterTooltip extends Swatch
   /**
    * Fill the tooltip with a new instance of the CSSFilterEditorWidget
    * widget initialized with the given filter value, and return a promise
    * that resolves to the instance of the widget when ready.
    */
 
   setFilterContent(filter) {
     const { doc } = this.tooltip;
+    this.tooltip.panel.innerHTML = "";
 
     const container = doc.createElementNS(XHTML_NS, "div");
     container.id = "filter-container";
 
     this.tooltip.panel.appendChild(container);
     this.tooltip.setContentSize({ width: 510, height: 200 });
 
     return new CSSFilterEditorWidget(container, filter, this._cssIsValid);