Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scope loading of module styles and scripts #351

Open
cojennin opened this issue May 17, 2016 · 1 comment
Open

Scope loading of module styles and scripts #351

cojennin opened this issue May 17, 2016 · 1 comment

Comments

@cojennin
Copy link
Contributor

Sometimes we check if we should load CSS and JS on a given page, sometimes we don't.

A patch for this issue would make it so a module's CSS and JS is loaded only when necessary instead of on every page in the admin.

This is consolidating tickets #239 and #242. Exists because of #263. Might also help scope (but not solve) cases like #323.

@JDGrimes
Copy link

I've just run into a plugin conflict caused by calendar.js. The function listening to $(document).click() was getting called on a plugin's admin screen, since it is loaded on every page in the admin. That results in reset_editorial_metadata() getting called, via edit_flow_calendar_close_overlays(). This will hide all elements on the page with the .editing class being hidden. My plugin WordPoints uses the .editing class on the WordPoints » Points Types admin screen, and so I received a report that a user who was testing out the plugin was clicking a button that was supposed to add an element to the screen, but the element was being hidden as soon as it was added, because it had the .editing class.

The code in calendar.js is just asking for conflicts. It should not only be loaded only where needed, but it should use more specific selectors, instead of targeting every single element on the entire screen via a generic class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants