Skip to content

Commit d551dce

Browse files
committed
Core: Don't use .apply() on console.log to satisfy IE9
Fixes #231
1 parent 9e3dfcb commit d551dce

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/migrate.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,25 @@
22

33
( function() {
44

5+
var rbadVersions = /^[12]\./;
6+
57
// Support: IE9 only
68
// IE9 only creates console object when dev tools are first opened
7-
// Also, avoid Function#bind here to simplify PhantomJS usage
8-
var log = window.console && window.console.log &&
9-
function() {
10-
window.console.log.apply( window.console, arguments );
11-
},
12-
rbadVersions = /^[12]\./;
13-
14-
if ( !log ) {
9+
// IE9 console is a host object, callable but doesn't have .apply()
10+
if ( !window.console || !window.console.log ) {
1511
return;
1612
}
1713

1814
// Need jQuery 3.0.0+ and no older Migrate loaded
1915
if ( !jQuery || rbadVersions.test( jQuery.fn.jquery ) ) {
20-
log( "JQMIGRATE: jQuery 3.0.0+ REQUIRED" );
16+
window.console.log( "JQMIGRATE: jQuery 3.0.0+ REQUIRED" );
2117
}
2218
if ( jQuery.migrateWarnings ) {
23-
log( "JQMIGRATE: Migrate plugin loaded multiple times" );
19+
window.console.log( "JQMIGRATE: Migrate plugin loaded multiple times" );
2420
}
2521

2622
// Show a message on the console so devs know we're active
27-
log( "JQMIGRATE: Migrate is installed" +
23+
window.console.log( "JQMIGRATE: Migrate is installed" +
2824
( jQuery.migrateMute ? "" : " with logging active" ) +
2925
", version " + jQuery.migrateVersion );
3026

0 commit comments

Comments
 (0)