BUG: `matches` function is not available on Element

Trying to use react-tooltip library, it fails when trying to call matches function on the element. Source code can be found in mouseOnToolTip function here: react-tooltip/index.js at ae936a5275ee4a2cf32a84dbf8dc004e20b748e1 · wwayne/react-tooltip · GitHub

if (show && this.tooltipRef) {
      /* old IE or Firefox work around */
      if (!this.tooltipRef.matches) {
        /* old IE work around */
        if (this.tooltipRef.msMatchesSelector) {
          this.tooltipRef.matches = this.tooltipRef.msMatchesSelector;
        } else {
          /* old Firefox work around */
          this.tooltipRef.matches = this.tooltipRef.mozMatchesSelector;
        }
      }
      return this.tooltipRef.matches(':hover');
    }

This code, even with workarounds, results in undefined matches function.

Workaround:

put this into index.html

<script>
      if (!Element.prototype.matches) {
        Element.prototype.matches =
          Element.prototype.matchesSelector ||
          Element.prototype.mozMatchesSelector ||
          Element.prototype.msMatchesSelector ||
          Element.prototype.oMatchesSelector ||
          Element.prototype.webkitMatchesSelector ||
          function (s) {
            var matches = (
                this.document || this.ownerDocument
              ).querySelectorAll(s),
              i = matches.length
            while (--i >= 0 && matches.item(i) !== this) {}
            return i > -1
          }
      }
    </script>

Not a bug. Just another thing that would be good to implement. UXP !== web browser

Element#matches is coming in UXP 5.0; it’s slated to be part of the next PS release.