Poltergeist - turning off JQMIGRATE warnings
Asked Answered
H

5

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?

Headquarters answered 23/7, 2013 at 6:49 Comment(0)
H
31

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

Homomorphism answered 23/7, 2013 at 7:34 Comment(2)
Can't you set it from outside the file, so that your changes don't get overridden when upgrading, etc?Microgamete
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.Nielson
K
31

Minified version is "muted" by default:

<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
Kherson answered 1/12, 2013 at 6:27 Comment(1)
Not true. I am using code.jquery.com/jquery-migrate-1.4.1.min.js and i see warning in console. I downloaded not minified, muted and reminifiedSuzannsuzanna
H
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.

Hadleigh answered 19/5, 2017 at 22:27 Comment(0)
D
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!

Dissenter answered 6/9, 2020 at 21:18 Comment(0)
B
-1

There is a newer minified version available.

<script src="http://code.jquery.com/jquery-migrate-3.0.0.min.js"></script>
Brutality answered 11/8, 2017 at 6:56 Comment(1)
mind that version 3.x is for migrating to jQuery v3+ only and cannot be used in that case!Mirilla

© 2022 - 2024 — McMap. All rights reserved.