Permalink
Browse files

Core: deprecate jQuery.now

Fixes gh-2959
Close gh-3884
  • Loading branch information...
timmywil committed Dec 11, 2017
1 parent 775caeb commit 909e0c99251ee56ec35db0e08d5b1e6219ac8fbc
Showing with 15 additions and 17 deletions.
  1. +2 −4 src/ajax/var/nonce.js
  2. +0 −2 src/core.js
  3. +2 −0 src/deprecated.js
  4. +2 −2 src/effects.js
  5. +1 −1 src/event.js
  6. +0 −2 test/unit/animation.js
  7. +2 −2 test/unit/core.js
  8. +6 −0 test/unit/deprecated.js
  9. +0 −2 test/unit/effects.js
  10. +0 −2 test/unit/tween.js
View
@@ -1,7 +1,5 @@
define( [
"../../core"
], function( jQuery ) {
define( function() {
"use strict";
return jQuery.now();
return Date.now();
} );
View
@@ -424,8 +424,6 @@ jQuery.extend( {
return proxy;
},
now: Date.now,
// jQuery.support is not used in Core but other projects attach their
// properties to it so it needs to exist.
support: support
View
@@ -41,4 +41,6 @@ jQuery.nodeName = nodeName;
jQuery.isWindow = isWindow;
jQuery.camelCase = camelCase;
jQuery.now = Date.now;
} );
View
@@ -45,7 +45,7 @@ function createFxNow() {
window.setTimeout( function() {
fxNow = undefined;
} );
return ( fxNow = jQuery.now() );
return ( fxNow = Date.now() );
}
// Generate parameters to create a standard animation
@@ -653,7 +653,7 @@ jQuery.fx.tick = function() {
i = 0,
timers = jQuery.timers;
fxNow = jQuery.now();
fxNow = Date.now();
for ( ; i < timers.length; i++ ) {
timer = timers[ i ];
View
@@ -553,7 +553,7 @@ jQuery.Event = function( src, props ) {
}
// Create a timestamp if incoming event doesn't have one
this.timeStamp = src && src.timeStamp || jQuery.now();
this.timeStamp = src && src.timeStamp || Date.now();
// Mark it as fixed
this[ jQuery.expando ] = true;
View
@@ -19,13 +19,11 @@ QUnit.module( "animation", {
this._oldInterval = jQuery.fx.interval;
jQuery.fx.step = {};
jQuery.fx.interval = 10;
jQuery.now = Date.now;
jQuery.Animation.prefilters = [ defaultPrefilter ];
jQuery.Animation.tweeners = { "*": [ defaultTweener ] };
},
teardown: function() {
this.sandbox.restore();
jQuery.now = Date.now;
jQuery.fx.stop();
jQuery.fx.interval = this._oldInterval;
window.requestAnimationFrame = oldRaf;
View
@@ -190,10 +190,10 @@ QUnit.test( "globalEval execution after script injection (#7862)", function( ass
script.src = baseURL + "mock.php?action=wait&wait=2&script=1";
now = jQuery.now();
now = Date.now();
document.body.appendChild( script );
jQuery.globalEval( "var strictEvalTest = " + jQuery.now() + ";" );
jQuery.globalEval( "var strictEvalTest = " + Date.now() + ";" );
assert.ok( window.strictEvalTest - now < 500, "Code executed synchronously" );
} );
View
@@ -202,3 +202,9 @@ QUnit.test( "jQuery.camelCase()", function( assert ) {
assert.equal( jQuery.camelCase( key ), val, "Converts: " + key + " => " + val );
} );
} );
QUnit.test( "jQuery.now", function( assert ) {
assert.expect( 1 );
assert.ok( typeof jQuery.now() === "number", "jQuery.now is a function" );
} );
View
@@ -19,11 +19,9 @@ QUnit.module( "effects", {
this._oldInterval = jQuery.fx.interval;
jQuery.fx.step = {};
jQuery.fx.interval = 10;
jQuery.now = Date.now;
},
teardown: function() {
this.sandbox.restore();
jQuery.now = Date.now;
jQuery.fx.stop();
jQuery.fx.interval = this._oldInterval;
window.requestAnimationFrame = oldRaf;
View
@@ -15,11 +15,9 @@ QUnit.module( "tween", {
this._oldInterval = jQuery.fx.interval;
jQuery.fx.step = {};
jQuery.fx.interval = 10;
jQuery.now = Date.now;
},
teardown: function() {
this.sandbox.restore();
jQuery.now = Date.now;
jQuery.fx.stop();
jQuery.fx.interval = this._oldInterval;
window.requestAnimationFrame = oldRaf;

0 comments on commit 909e0c9

Please sign in to comment.