Bug 1578736 - Revised updatePasswordRevelState to use replaceWith method r=jaws
authormcrawford@mozilla.com <mcrawford@mozilla.com>
Tue, 25 Feb 2020 20:42:18 +0000
changeset 515563 675a2bd332a67ce13afb18c5a208faeeda4eed30
parent 515562 1ccf1ec84fea1c01594b200e3a33e6645266cd08
child 515564 e3a8032a4a14c42613e8c43bcfb9d42614c56a5d
push id37158
push useropoprus@mozilla.com
push dateWed, 26 Feb 2020 09:27:57 +0000
treeherdermozilla-central@7f41334e1044 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1578736
milestone75.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1578736 - Revised updatePasswordRevelState to use replaceWith method r=jaws Differential Revision: https://phabricator.services.mozilla.com/D64001
browser/components/aboutlogins/content/components/login-item.js
--- a/browser/components/aboutlogins/content/components/login-item.js
+++ b/browser/components/aboutlogins/content/components/login-item.js
@@ -796,27 +796,19 @@ export default class LoginItem extends H
     let { checked } = this._revealCheckbox;
     let inputType = checked ? "text" : "password";
     this._passwordInput.type = inputType;
 
     // Swap which <input> is in the document depending on whether we need the
     // real .value (which means that the master password was already entered,
     // if applicable)
     if (checked || this.dataset.editing) {
-      this._revealCheckbox.insertAdjacentElement(
-        "beforebegin",
-        this._passwordInput
-      );
-      this._passwordDisplayInput.remove();
+      this._passwordDisplayInput.replaceWith(this._passwordInput);
     } else {
-      this._revealCheckbox.insertAdjacentElement(
-        "beforebegin",
-        this._passwordDisplayInput
-      );
-      this._passwordInput.remove();
+      this._passwordInput.replaceWith(this._passwordDisplayInput);
     }
   }
 
   _updateOriginDisplayState() {
     // Switches between the origin input and anchor tag depending
     // if a new login is being created.
     if (this.dataset.editing) {
       this._originDisplayInput.replaceWith(this._originInput);