21

When running my test suite using poltergeist as the JavaScript driver, I am encountering the following warnings:

JQMIGRATE: jQuery.fn.attr(selected) may use property instead of attribute
JQMIGRATE: jQuery.browser is deprecated

Is that possible to turn them off?

Ivan Chernykh
  • 41,617
  • 13
  • 134
  • 146
alexs333
  • 12,143
  • 11
  • 51
  • 89

5 Answers5

31

Minified version is "muted" by default:

<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
Ivan Chernykh
  • 41,617
  • 13
  • 134
  • 146
  • Not true. I am using https://code.jquery.com/jquery-migrate-1.4.1.min.js and i see warning in console. I downloaded not minified, muted and reminified – realtebo Apr 22 '22 at 08:44
30

Look for jQuery.migrateMute = false in jquery-migrate.js and set it to true

benchwarmer
  • 2,764
  • 23
  • 25
  • 6
    Can't you set it from outside the file, so that your changes don't get overridden when upgrading, etc? – Ian Dunn Jan 19 '16 at 22:47
  • Alternatively you can indeed just set it to true in your own scripts (outside of migrate script). Tested it on my own project and it works. – Studocwho Aug 14 '17 at 18:38
4

Following the answer from benchwarmer, this:

function custom_mute_jquery_migrator() {   
    echo '<script>jQuery.migrateMute = true;</script>';
}
add_action( 'wp_head', 'custom_mute_jquery_migrator' );
add_action( 'admin_head', 'custom_mute_jquery_migrator' );

Fixed it for me. Thanks @benchwarmer.

user382738
  • 787
  • 2
  • 7
  • 12
0

I resolve that problem (temporarily) by adding to functions.php:

    function my_custom_fonts() {
  echo '<style>
    .jquery-migrate-deprecation-notice{
    display: none !important;
}
    } 
  </style>';
}

and it works!

-1

There is a newer minified version available.

<script src="http://code.jquery.com/jquery-migrate-3.0.0.min.js"></script>
Sikandar Amla
  • 1,415
  • 18
  • 27