Coveralls logob
Coveralls logo
  • Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jquery / jquery-migrate / 146

5 Aug 2016 - 12:24 coverage: 87.5% (-1.05%) from 88.546%
146

Pull #216

travis-ci

9181eb84f9c35729a3bad740fb7f9d93?size=18&default=identiconweb-flow
squash! Ensure warnings are skipped on non-rAF browsers
Pull Request #216: Effects: Warn and fill jQuery.fx.interval

2 of 5 new or added lines in 2 files covered. (40.0%)

203 of 232 relevant lines covered (87.5%)

8.94 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

76.32
/src/migrate.js
1

2
( function() {
1×
3

4
        // Support: IE9 only
5
        // IE9 only creates console object when dev tools are first opened
6
        // Also, avoid Function#bind here to simplify PhantomJS usage
7
        var log = window.console && window.console.log &&
1×
8
                        function() { window.console.log.apply( window.console, arguments ); },
1×
9
                rbadVersions = /^[12]\./;
10

11
        if ( !log ) {
1×
12
                return;
!
13
        }
14

15
        // Need jQuery 3.0.0+ and no older Migrate loaded
16
        if ( !jQuery || rbadVersions.test( jQuery.fn.jquery ) ) {
1×
17
                log( "JQMIGRATE: jQuery 3.0.0+ REQUIRED" );
!
18
        }
19
        if ( jQuery.migrateWarnings ) {
1×
20
                log( "JQMIGRATE: Migrate plugin loaded multiple times" );
!
21
        }
22

23
        // Show a message on the console so devs know we're active
24
        log( "JQMIGRATE: Migrate is installed" +
1×
25
                ( jQuery.migrateMute ? "" : " with logging active" ) +
26
                ", version " + jQuery.migrateVersion );
27

28
} )();
29

30
var warnedAbout = {};
1×
31

32
// List of warnings already given; public read only
33
jQuery.migrateWarnings = [];
1×
34

35
// Set to false to disable traces that appear with warnings
36
if ( jQuery.migrateTrace === undefined ) {
1×
37
        jQuery.migrateTrace = true;
1×
38
}
39

40
// Forget any warnings we've already given; public
41
jQuery.migrateReset = function() {
1×
42
        warnedAbout = {};
56×
43
        jQuery.migrateWarnings.length = 0;
56×
44
};
45

46
function migrateWarn( msg ) {
1×
47
        var console = window.console;
79×
48
        if ( !warnedAbout[ msg ] ) {
79×
49
                warnedAbout[ msg ] = true;
49×
50
                jQuery.migrateWarnings.push( msg );
49×
51
                if ( console && console.warn && !jQuery.migrateMute ) {
49×
52
                        console.warn( "JQMIGRATE: " + msg );
!
53
                        if ( jQuery.migrateTrace && console.trace ) {
!
54
                                console.trace();
!
55
                        }
56
                }
57
        }
58
}
59

60
function migrateWarnProp( obj, prop, value, msg ) {
1×
61
        Object.defineProperty( obj, prop, {
3×
62
                configurable: true,
63
                enumerable: true,
64
                get: function() {
65
                        migrateWarn( msg );
2×
66
                        return value;
2×
67
                },
68
                set: function( newValue ) {
NEW
69
                        migrateWarn( msg );
!
NEW
70
                        value = newValue;
!
71
                }
72
        } );
73
}
74

75
function migrateWarnFunc( obj, prop, newFunc, msg ) {
1×
76
        obj[ prop ] = function() {
7×
77
                migrateWarn( msg );
4×
78
                return newFunc.apply( this, arguments );
4×
79
        };
80
}
81

82
if ( document.compatMode === "BackCompat" ) {
1×
83

84
        // JQuery has never supported or tested Quirks Mode
85
        migrateWarn( "jQuery is not compatible with Quirks Mode" );
!
86
}
Troubleshooting · Open an Issue · Sales · Support · ENTERPRISE · CAREERS · STATUS
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2023 Coveralls, Inc