Bug 1498594 - Remove mail-emailheaderfield binding. r=mkmelin
authorArshad Khan <arshdkhn1@gmail.com>
Fri, 12 Oct 2018 20:23:49 +0530
changeset 33648 cffa7cb63305e24e8a6c72717e457d6fdcb9298d
parent 33647 5929093fee143b935be3b26333e6ab541c4f271f
child 33649 e55a387029ad1b912ca02255f7a981043eb517fb
push id388
push userclokep@gmail.com
push dateMon, 28 Jan 2019 20:54:56 +0000
reviewersmkmelin
bugs1498594
Bug 1498594 - Remove mail-emailheaderfield binding. r=mkmelin
mail/base/content/mailWidgets.js
mail/base/content/mailWidgets.xml
mail/base/content/messenger.css
--- a/mail/base/content/mailWidgets.js
+++ b/mail/base/content/mailWidgets.js
@@ -244,16 +244,30 @@ class MozMailEmailaddress extends MozXUL
     });
 
     emailPresenceImage.addEventListener("click", (event) => {
       onClickEmailPresence(event, this);
     });
   }
 }
 
+class MozMailEmailheaderfield extends MozXULElement {
+  connectedCallback() {
+    this._mailEmailAddress = document.createElement("mail-emailaddress");
+    this._mailEmailAddress.classList.add("headerValue");
+    this._mailEmailAddress.setAttribute("containsEmail", "true");
+
+    this.appendChild(this._mailEmailAddress);
+  }
+
+  get emailAddressNode() {
+    return this._mailEmailAddress;
+  }
+}
+
 class MozTreecolImage extends customElements.get("treecol") {
   static get observedAttributes() {
     return ["src"];
   }
 
   connectedCallback() {
     this.image = document.createElement("image");
     this.image.classList.add("treecol-icon");
@@ -283,9 +297,10 @@ class MozTreecolImage extends customElem
 
 customElements.define("mail-headerfield", MozMailHeaderfield);
 customElements.define("mail-urlfield", MozMailUrlfield);
 customElements.define("mail-tagfield", MozMailHeaderfieldTags);
 customElements.define("mail-newsgroup", MozMailNewsgroup);
 customElements.define("mail-newsgroups-headerfield", MozMailNewsgroupsHeaderfield);
 customElements.define("mail-messageid", MozMailMessageid);
 customElements.define("mail-emailaddress", MozMailEmailaddress);
+customElements.define("mail-emailheaderfield", MozMailEmailheaderfield);
 customElements.define("treecol-image", MozTreecolImage, { extends: "treecol" });
--- a/mail/base/content/mailWidgets.xml
+++ b/mail/base/content/mailWidgets.xml
@@ -443,30 +443,16 @@
         let evt = document.createEvent("XULCommandEvent");
         evt.initCommandEvent("command", true, true, window, 0, event.ctrlKey,
                              event.altKey, event.shiftKey, event.metaKey, null);
         this.dispatchEvent(evt);
       ]]></handler>
     </handlers>
   </binding>
 
-  <!-- Message Pane Widgets -->
-
-  <binding id="mail-emailheaderfield">
-    <content>
-      <xul:mail-emailaddress class="headerValue" containsEmail="true"
-                             anonid="emailAddressNode"/>
-    </content>
-
-    <implementation>
-      <property name="emailAddressNode" onget="return document.getAnonymousElementByAttribute(this, 'anonid', 'emailAddressNode');"
-        readonly="true"/>
-    </implementation>
-  </binding>
-
   <!-- multi-emailHeaderField: presents multiple emailheaderfields with a toggle -->
   <binding id="mail-multi-emailHeaderField">
     <content>
       <xul:hbox class="headerValueBox" anonid="longEmailAddresses" flex="1"
                 singleline="true"
                 align="baseline">
         <xul:description class="headerValue" containsEmail="true"
                          anonid="emailAddresses" flex="1"
--- a/mail/base/content/messenger.css
+++ b/mail/base/content/messenger.css
@@ -27,20 +27,16 @@ mail-messageids-headerfield {
 .emailStar {
   -moz-user-focus: normal;
 }
 
 .emailPopup {
   -moz-user-focus: normal;
 }
 
-mail-emailheaderfield {
-  -moz-binding: url("chrome://messenger/content/mailWidgets.xml#mail-emailheaderfield");
-}
-
 mail-multi-emailHeaderField {
   -moz-binding: url("chrome://messenger/content/mailWidgets.xml#mail-multi-emailHeaderField");
 }
 
 mail-tagfield[collapsed="true"] {
   display: none;
 }