Opened 7 years ago
Last modified 3 years ago
#43654 new defect (bug)
Silence "JQMIGRATE: Migrate is installed with logging active, version x.y.z"
Reported by: | markjaquith | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | low |
Severity: | trivial | Version: | |
Component: | General | Keywords: | close |
Focuses: | javascript | Cc: |
Description
jQuery Migrate annoyingly announces itself in the console when it loads. This message is not useful. Can we silence it?
JQMIGRATE: Migrate is installed with logging active, version 1.4.1
Change History (8)
#2
follow-up:
↓ 3
@
7 years ago
JQMIGRATE: Migrate is installed with logging active, version X
This is not a warning, but a console log message the plugin shows when it first loads to indicate whether warnings will be shown on the console when appropriate. As of version 1.4.0 this message is also shown with production builds.
Further background on this decision can be read in jquery-migrate #149 and jquery-migrate #240
The only way I see to silence the warning is to roll-our-own, we can modify src/wp-includes/js/jquery/jquery-migrate.js#L21 (and minimize this version) to replace it with the previous jquery-migrate code
#3
in reply to:
↑ 2
;
follow-up:
↓ 4
@
7 years ago
Replying to netweb:
The only way I see to silence the warning is to roll-our-own, we can modify src/wp-includes/js/jquery/jquery-migrate.js#L21 (and minimize this version) to replace it with the previous jquery-migrate code
Note: As part of #43055 for WP 5.0 the plan is to pull jquery-migrate into WordPress via npm, as such we'd want to fork jquery-migrate
for these changes so that npm can pull in our custom fork.
#4
in reply to:
↑ 3
@
7 years ago
- Keywords close added
Replying to netweb:
As such we'd want to fork
jquery-migrate
for these changes so that npm can pull in our custom fork.
I'm inclined to close this wont fix.
Maintaining a custom fork is a lot of effort to go to to remove a message most users won't see.
#5
@
6 years ago
The best solution would be for Wordpress to not use Migrate as a production tool. Since Migrate imperfectly tries to introduce deprecated behavior back into newer versions of jQuery, the result is a bit of a Frankenstein's monster that isn't the same as the version of jQuery that appears to be running.
If there are things the jQuery team can do to help move Wordpress to a newer version of jQuery let us know. It appears Wordpress no longer needs support for browsers older than IE11, if that's the case it should be possible to use jQuery 3.3.1 which supports browsers back to IE9. Does Wordpress itself need Migrate, or is it for the benefit of older themes?
#6
@
6 years ago
Can you just remove Migrate? The current version in the backend seems to be 1.12.4. And jQuery v3 brought in a lot of depreciations iirc.
I'm all for using the latest stable versions, but we need to be careful not to break anything.
#7
@
6 years ago
So I just had a bad experience with deregistering jquery-migrate
. Turns out jquery
is dependant on it (totally did not see that coming).
The comment from Otto https://core.trac.wordpress.org/ticket/32793#comment:1 even provides a link that says it can incorporate vulnerabilities in the app.
I'm all for removing it.
#8
@
3 years ago
Here's something that disables all the console.trace-ing:
<?php function _jqmigrate_mute() { wp_add_inline_script('jquery-migrate', 'jQuery.migrateMute = true;', 'before'); } add_action('wp_enqueue_scripts', '_jqmigrate_mute'); add_action('admin_enqueue_scripts', '_jqmigrate_mute');
It doesn't silence the initial announcement, but it saves a heck of a lot of space otherwise.
Related: https://wordpress.stackexchange.com/questions/224661/annoying-jqmigrate-migrate-is-in-console-after-update-to-wp-4-5 :D