mirror of
https://github.com/jquery/jquery.git
synced 2025-01-10 18:24:24 +00:00
Build: Switch to explicit dependencies versions in bower.json
(cherry-picked from cd4e25e991
)
This commit is contained in:
parent
4c7250cf2f
commit
2f202b034f
@ -16,9 +16,9 @@
|
||||
"sizzle": "1.10.16"
|
||||
},
|
||||
"devDependencies": {
|
||||
"requirejs": "~2.1.8",
|
||||
"qunit": "~1.12.0",
|
||||
"sinon": "~1.7.3"
|
||||
"requirejs": "2.1.10",
|
||||
"qunit": "1.12.0",
|
||||
"sinon": "1.8.1"
|
||||
},
|
||||
"keywords": [
|
||||
"jquery",
|
||||
|
@ -31,6 +31,10 @@ if (typeof sinon == "undefined") {
|
||||
throw new Error("Function requires at least 1 parameter");
|
||||
}
|
||||
|
||||
if (typeof args[0] === "undefined") {
|
||||
throw new Error("Callback must be provided to timer calls");
|
||||
}
|
||||
|
||||
var toId = id++;
|
||||
var delay = args[1] || 0;
|
||||
|
||||
@ -132,6 +136,16 @@ if (typeof sinon == "undefined") {
|
||||
this.clearTimeout(timerId);
|
||||
},
|
||||
|
||||
setImmediate: function setImmediate(callback) {
|
||||
var passThruArgs = Array.prototype.slice.call(arguments, 1);
|
||||
|
||||
return addTimer.call(this, [callback, 0].concat(passThruArgs), false);
|
||||
},
|
||||
|
||||
clearImmediate: function clearImmediate(timerId) {
|
||||
this.clearTimeout(timerId);
|
||||
},
|
||||
|
||||
tick: function tick(ms) {
|
||||
ms = typeof ms == "number" ? ms : parseTime(ms);
|
||||
var tickFrom = this.now, tickTo = this.now + ms, previous = this.now;
|
||||
@ -162,7 +176,7 @@ if (typeof sinon == "undefined") {
|
||||
},
|
||||
|
||||
firstTimerInRange: function (from, to) {
|
||||
var timer, smallest, originalTimer;
|
||||
var timer, smallest = null, originalTimer;
|
||||
|
||||
for (var id in this.timeouts) {
|
||||
if (this.timeouts.hasOwnProperty(id)) {
|
||||
@ -170,7 +184,7 @@ if (typeof sinon == "undefined") {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!smallest || this.timeouts[id].callAt < smallest) {
|
||||
if (smallest === null || this.timeouts[id].callAt < smallest) {
|
||||
originalTimer = this.timeouts[id];
|
||||
smallest = this.timeouts[id].callAt;
|
||||
|
||||
@ -276,21 +290,39 @@ if (typeof sinon == "undefined") {
|
||||
target.parse = source.parse;
|
||||
target.UTC = source.UTC;
|
||||
target.prototype.toUTCString = source.prototype.toUTCString;
|
||||
|
||||
for (var prop in source) {
|
||||
if (source.hasOwnProperty(prop)) {
|
||||
target[prop] = source[prop];
|
||||
}
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
var methods = ["Date", "setTimeout", "setInterval",
|
||||
"clearTimeout", "clearInterval"];
|
||||
|
||||
if (typeof global.setImmediate !== "undefined") {
|
||||
methods.push("setImmediate");
|
||||
}
|
||||
|
||||
if (typeof global.clearImmediate !== "undefined") {
|
||||
methods.push("clearImmediate");
|
||||
}
|
||||
|
||||
function restore() {
|
||||
var method;
|
||||
|
||||
for (var i = 0, l = this.methods.length; i < l; i++) {
|
||||
method = this.methods[i];
|
||||
|
||||
if (global[method].hadOwnProperty) {
|
||||
global[method] = this["_" + method];
|
||||
} else {
|
||||
delete global[method];
|
||||
try {
|
||||
delete global[method];
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
|
||||
@ -341,11 +373,13 @@ if (typeof sinon == "undefined") {
|
||||
sinon.timers = {
|
||||
setTimeout: setTimeout,
|
||||
clearTimeout: clearTimeout,
|
||||
setImmediate: (typeof setImmediate !== "undefined" ? setImmediate : undefined),
|
||||
clearImmediate: (typeof clearImmediate !== "undefined" ? clearImmediate: undefined),
|
||||
setInterval: setInterval,
|
||||
clearInterval: clearInterval,
|
||||
Date: Date
|
||||
};
|
||||
|
||||
if (typeof module == "object" && typeof require == "function") {
|
||||
if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = sinon;
|
||||
}
|
||||
|
@ -14,6 +14,8 @@
|
||||
*/
|
||||
function setTimeout() {}
|
||||
function clearTimeout() {}
|
||||
function setImmediate() {}
|
||||
function clearImmediate() {}
|
||||
function setInterval() {}
|
||||
function clearInterval() {}
|
||||
function Date() {}
|
||||
@ -22,6 +24,8 @@ function Date() {}
|
||||
// should be true. Hackish, I know, but it works.
|
||||
setTimeout = sinon.timers.setTimeout;
|
||||
clearTimeout = sinon.timers.clearTimeout;
|
||||
setImmediate = sinon.timers.setImmediate;
|
||||
clearImmediate = sinon.timers.clearImmediate;
|
||||
setInterval = sinon.timers.setInterval;
|
||||
clearInterval = sinon.timers.clearInterval;
|
||||
Date = sinon.timers.Date;
|
||||
|
Loading…
Reference in New Issue
Block a user