[wp-trac] [WordPress Trac] #56185: Having an element with id="module" in the admin panel generates a regenerator-runtime.js error

WordPress Trac noreply at wordpress.org
Sat Jul 9 21:38:44 UTC 2022


#56185: Having an element with id="module" in the admin panel generates a
regenerator-runtime.js error
----------------------------+------------------------------
 Reporter:  m1r0            |       Owner:  (none)
     Type:  defect (bug)    |      Status:  assigned
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Administration  |     Version:  trunk
 Severity:  minor           |  Resolution:
 Keywords:  close           |     Focuses:  javascript
----------------------------+------------------------------
Changes (by TimothyBlynJacobs):

 * keywords:   => close


Comment:

 Hi @m1r0,

 I don't think this is a bug in the regenerator runtime codebase itself. I
 think this is part of CommonJS which uses the `module` global to pass
 dependencies around.

 Part of how browsers work is they
 [https://stackoverflow.com/questions/3434278/do-dom-tree-elements-with-
 ids-become-global-properties globalize] any HTML elements with an `id`.

 This is then conflicting with the CommonJS code that is looking for a
 global named `module`.

 My recommendation would be to [https://developer.wordpress.org/plugins
 /plugin-basics/best-practices/#prefix-everything prefix everything], that
 includes classes and ids.

 Cc: @youknowriad who is the author of Regenerator Runtime.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56185#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list