src/utils/custom-element.js
function createBaseCustomElementClass(win) {
  if (win.BaseCustomElementClass) {
    return win.BaseCustomElementClass;
  }
  const htmlElement = win.HTMLElement;
  /** @abstract @extends {HTMLElement} */
  class BaseCustomElement extends htmlElement {
    /**
     * @see https://github.com/WebReflection/document-register-element#v1-caveat
     * @suppress {checkTypes}
     */
    constructor(self) {
      self = super(self);
      self.createdCallback(self.getChildren());
      return self;
    }

    /**
     * Called when elements is created. Sets instance vars since there is no
     * constructor.
     * @this {!Element}
     */
    createdCallback() {
    }

    attributeChangedCallback(attrName, oldVal, newVal) {
    }

    /**
     * Called when the element is first connected to the DOM. Calls
     * {@link firstAttachedCallback} if this is the first attachment.
     * @final @this {!Element}
     */
    connectedCallback() {
    }

    /** The Custom Elements V0 sibling to `connectedCallback`. */
    attachedCallback() {
      this.connectedCallback();
    }

    /**
     * Called when the element is disconnected from the DOM.
     * @final @this {!Element}
     */
    disconnectedCallback() {
    }

    /** The Custom Elements V0 sibling to `disconnectedCallback`. */
    detachedCallback() {
      this.disconnectedCallback();
    }

    getChildren() {
      return [].slice.call(this.childNodes);
    }
  }

  win.BaseCustomElementClass = BaseCustomElement;
  return win.BaseCustomElementClass;
}
function createBaseCustomElementClass(win) {
  if (win.BaseCustomElementClass) {
    return win.BaseCustomElementClass;
  }
  const htmlElement = win.HTMLElement;
  /** @abstract @extends {HTMLElement} */
  class BaseCustomElement extends htmlElement {
    /**
     * @see https://github.com/WebReflection/document-register-element#v1-caveat
     * @suppress {checkTypes}
     */
    constructor(self) {
      self = super(self);
      self.createdCallback(self.getChildren());
      return self;
    }

    /**
     * Called when elements is created. Sets instance vars since there is no
     * constructor.
     * @this {!Element}
     */
    createdCallback() {
    }

    attributeChangedCallback(attrName, oldVal, newVal) {
    }

    /**
     * Called when the element is first connected to the DOM. Calls
     * {@link firstAttachedCallback} if this is the first attachment.
     * @final @this {!Element}
     */
    connectedCallback() {
    }

    /** The Custom Elements V0 sibling to `connectedCallback`. */
    attachedCallback() {
      this.connectedCallback();
    }

    /**
     * Called when the element is disconnected from the DOM.
     * @final @this {!Element}
     */
    disconnectedCallback() {
    }

    /** The Custom Elements V0 sibling to `disconnectedCallback`. */
    detachedCallback() {
      this.disconnectedCallback();
    }

    getChildren() {
      return [].slice.call(this.childNodes);
    }
  }

  win.BaseCustomElementClass = BaseCustomElement;
  return win.BaseCustomElementClass;
}
function createBaseCustomElementClass ( win ) { if ( win . BaseCustomElementClass ) { return win . BaseCustomElementClass ; } const htmlElement = win . HTMLElement ; /** @abstract @extends {HTMLElement} */ class BaseCustomElement extends htmlElement { /**
     * @see https://github.com/WebReflection/document-register-element#v1-caveat
     * @suppress {checkTypes}
     */ constructor ( self ) { self = super ( self ) ; self . createdCallback ( self . getChildren ( ) ) ; return self ; } /**
     * Called when elements is created. Sets instance vars since there is no
     * constructor.
     * @this {!Element}
     */ createdCallback ( ) { } attributeChangedCallback ( attrName , oldVal , newVal ) { } /**
     * Called when the element is first connected to the DOM. Calls
     * {@link firstAttachedCallback} if this is the first attachment.
     * @final @this {!Element}
     */ connectedCallback ( ) { } /** The Custom Elements V0 sibling to `connectedCallback`. */ attachedCallback ( ) { this . connectedCallback ( ) ; } /**
     * Called when the element is disconnected from the DOM.
     * @final @this {!Element}
     */ disconnectedCallback ( ) { } /** The Custom Elements V0 sibling to `disconnectedCallback`. */ detachedCallback ( ) { this . disconnectedCallback ( ) ; } getChildren ( ) { return [ ] . slice . call ( this . childNodes ) ; } } win . BaseCustomElementClass = BaseCustomElement ; return win . BaseCustomElementClass ; }
Creates a base custom element class.

@param {!Window} win The window in which to register the custom element.
@return {!Function}
Creates a base custom element class .