Opened 2 years ago
Closed 2 years ago
#56185 closed defect (bug) (invalid)
Having an element with id="module" in the admin panel generates a regenerator-runtime.js error
Reported by: | m1r0 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | |
Component: | Administration | Keywords: | close |
Focuses: | javascript | Cc: |
Description
I've noticed this minor bug while making a custom post type column named "module" but it could be reproduced by adding any HTML element with the id "module".
These are the steps to reproduce the issue:
- In the admin panel, create an element with the id="module".
<?php add_action( 'admin_footer', function() { echo '<div id="module"></div>'; } );
- Refresh the admin panel and open the console in the browser.
- You should see a bunch of errors and the first one should be
Cannot set properties of undefined (setting 'wrap')
.
After enabling SCRIPT_DEBUG
, I've tracked down the error to regenerator-runtime.js
.
regenerator-runtime.js?ver=0.13.9:49 Uncaught TypeError: Cannot set properties of undefined (setting 'wrap') at regenerator-runtime.js?ver=0.13.9:49:16 at regenerator-runtime.js?ver=0.13.9:728:2
Cheers and thanks for the great work!
Change History (4)
#2
@
2 years ago
Thanks for the suggestion, @TimothyBlynJacobs!
Just to clarify and potentially help someone, I've come across this issue by creating a custom column named "module" which in turn created a table header with that ID. (<th scope="col" id="module" class="manage-column column-module">Module</th>
)
#3
@
2 years ago
- Milestone Awaiting Review deleted
- Version trunk deleted
@TimothyBlynJacobs Regenerator runtime is a Facebook package we pull in from npm.
Closing this one out as there does not seem to be any action required.
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 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 prefix everything, that includes classes and ids.
Cc: @youknowriad who is the author of Regenerator Runtime.