[wp-trac] [WordPress Trac] #58145: JS error: caught ReferenceError: Element is not defined

WordPress Trac noreply at wordpress.org
Mon Apr 17 13:20:21 UTC 2023


#58145: JS error: caught ReferenceError: Element is not defined
--------------------------+-----------------------------
 Reporter:  jankyz        |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Editor        |    Version:  6.2
 Severity:  normal        |   Keywords:
  Focuses:  javascript    |
--------------------------+-----------------------------
 I've got a console error on editor level

 uncaught ReferenceError: Element is not defined

 file: wp-polyfill-inert.js
 line:30


 {{{
 (function () {
     // Return early if we're not running inside of the browser.
     if (typeof window === 'undefined') {
       return;
     }

     // Convenience function for converting NodeLists.
     /** @type {typeof Array.prototype.slice} */
     var slice = Array.prototype.slice;

     /**
      * IE has a non-standard name for "matches".
      * @type {typeof Element.prototype.matches}
      */
     var matches = Element.prototype.matches ||
 Element.prototype.msMatchesSelector;
 }}}

 suggestion
 {{{
 (function () {
     // Return early if we're not running inside of the browser.
     if (typeof window === 'undefined' || window?.Element) {
       return;
     }

     // Convenience function for converting NodeLists.
     /** @type {typeof Array.prototype.slice} */
     var slice = Array.prototype.slice;

     /**
      * IE has a non-standard name for "matches".
      * @type {typeof Element.prototype.matches}
      */
     var matches = Element.prototype.matches ||
 Element.prototype.msMatchesSelector;
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58145>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list