? Pending

User tests: Successful: Unsuccessful:

avatar regularlabs
regularlabs
3 Jul 2017

The jquery-migrate.js outputs this to the browsers console:
JQMIGRATE: Migrate is installed, version 1.4.1
This is useless and should not happen on a production environment.

This PR removes the console.log output when jQuery.migrateMute is true.
jQuery.migrateMute is true by default in the minified jquery-migrate.min.js (which is the one that gets loaded if debugging is off).

Testing instructions

Check the browser's console before and after this PR

avatar regularlabs regularlabs - open - 3 Jul 2017
avatar regularlabs regularlabs - change - 3 Jul 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 3 Jul 2017
Category JavaScript
avatar wilsonge
wilsonge - comment - 3 Jul 2017

Whilst I agree it's not ideal on production, I'm also mildly nervous about hacking up more third party libraries :/

avatar regularlabs
regularlabs - comment - 3 Jul 2017

It isn't a library file that will ever get updated anyway.
We are stuck with that version (seeing we are also stuck with the version of jQuery).
So why not improve it?

avatar laoneo
laoneo - comment - 3 Jul 2017

This console warning bugs me as well all the time, but I'm here with @wilsonge, hacking external files should be avoided.

avatar mbabker
mbabker - comment - 3 Jul 2017

I agree with the principle but I really wish there were a way to do it without modifying third party code ?

avatar regularlabs
regularlabs - comment - 3 Jul 2017

Only way is to override the whole script via the template.
So a non-core way.
But that is no use to the bulk of the users.

avatar laoneo
laoneo - comment - 3 Jul 2017

Perhaps an issue should be opened against upstream https://github.com/jquery/jquery-migrate?

avatar regularlabs
regularlabs - comment - 3 Jul 2017

It's been requested there a couple of times. But they don't want to remove it. As they say the migrate script should be a temporary solution while you fix your scripts to work with jQuery 3.
Clearly Joomla 3 does use it as a permanent solution.

avatar dgt41
dgt41 - comment - 3 Jul 2017

But they don't want to remove it.

@regularlabs that's a correct approach, migrate was created as a helper for developers to easily upgrade their scripts. Joomla made a wrong decision to force that script in every request that jQuery was needed. I guess we have to live with it till Joomla 4 where migrate won't be delivered by default (also by default core will NOT be using jQuery ? and hopefully most devs will follow that pattern)

avatar mbabker
mbabker - comment - 3 Jul 2017

As they say the migrate script should be a temporary solution while you fix your scripts to work with jQuery 3.

In 4.0 we aren't turning on jQuery Migrate by default anymore, it'll be up to extensions who need it to do so. So in that regard, while we're still giving devs the ability to use it, we aren't leaning on it ourselves going forward.

Clearly Joomla 3 does use it as a permanent solution.

We had to because of the B/C breaks jQuery 1.9 introduced, otherwise we would've been stuck on shipping jQuery 1.8 with core for the full lifecycle. And it's not so much the jQuery code that ships with core that's an issue, rather knowing that extensions are shipping all sorts of versions of plugins which may or may not have dealt with those compatibility problems at the time. Looking back, I almost wish we would've defaulted Migrate to off when first introduced and forced devs who need it to enable it, but hindsight's 20/20.

avatar regularlabs
regularlabs - comment - 3 Jul 2017

So I guess this is a dead end and a close?

avatar regularlabs
regularlabs - comment - 3 Jul 2017

I'll just solve it with ReReplacer for my own sites by removing the whole migrate script :)
Search (Regular Expressions):

<script src="[^"]*/jquery-noconflict\.js[^"]*" type="text/javascript"></script>(\s*<script src="[^"]*/jquery-migrate(\.min)?\.js[^"]*" type="text/javascript"></script>)

Replace:

<script type="text/javascript">jQuery.noConflict();</script>

This also inlines the noConflict line.

avatar brianteeman
brianteeman - comment - 5 Jul 2017

closed for reasons stated above

avatar brianteeman brianteeman - change - 5 Jul 2017
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2017-07-05 15:35:09
Closed_By brianteeman
Labels Added: ?
avatar brianteeman brianteeman - close - 5 Jul 2017

Add a Comment

Login with GitHub to post a comment