Bug 1517981 - Add the ability to extend the richlistbox Custom Element class;r=paolo
authorBrian Grinstead <bgrinstead@mozilla.com>
Sat, 05 Jan 2019 22:08:58 +0000
changeset 509751 9aa94abacb927c5803092a774659bd7644cc46cb
parent 509750 f55412c54286167462200b2d240236b16156cfae
child 509757 27ef389fd0b9c9fc65b86d495f9fecf52e3544de
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspaolo
bugs1517981
milestone66.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 1517981 - Add the ability to extend the richlistbox Custom Element class;r=paolo Differential Revision: https://phabricator.services.mozilla.com/D15698
toolkit/content/widgets/richlistbox.js
--- a/toolkit/content/widgets/richlistbox.js
+++ b/toolkit/content/widgets/richlistbox.js
@@ -1,19 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
 "use strict";
 
-// This is loaded into all XUL windows. Wrap in a block to prevent
-// leaking to window scope.
-{
+// This is loaded into chrome windows with the subscript loader. If you need to
+// define globals, wrap in a block to prevent leaking onto `window`.
 
-class MozRichListBox extends MozElements.BaseControl {
+MozElements.RichListBox = class RichListBox extends MozElements.BaseControl {
   constructor() {
     super();
 
     this.addEventListener("keypress", event => {
       if (event.altKey || event.metaKey) {
         return;
       }
 
@@ -813,18 +811,16 @@ class MozRichListBox extends MozElements
 
   /**
    * For backwards-compatibility and for convenience.
    * Use ensureElementIsVisible instead
    */
   ensureSelectedElementIsVisible() {
     return this.ensureElementIsVisible(this.selectedItem);
   }
-}
+};
 
-MozXULElement.implementCustomInterface(MozRichListBox, [
+MozXULElement.implementCustomInterface(MozElements.RichListBox, [
   Ci.nsIDOMXULSelectControlElement,
   Ci.nsIDOMXULMultiSelectControlElement,
 ]);
 
-customElements.define("richlistbox", MozRichListBox);
-
-}
+customElements.define("richlistbox", MozElements.RichListBox);