mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Update vendors.
Former-commit-id: d1dd2ecf337cf8cda71e0da2af0647813b8de24a
This commit is contained in:
8
vendor/backbone/backbone.js
vendored
8
vendor/backbone/backbone.js
vendored
@@ -134,6 +134,9 @@
|
|||||||
|
|
||||||
rest = [];
|
rest = [];
|
||||||
events = events.split(eventSplitter);
|
events = events.split(eventSplitter);
|
||||||
|
|
||||||
|
// Fill up `rest` with the callback arguments. Since we're only copying
|
||||||
|
// the tail of `arguments`, a loop is much faster than Array#slice.
|
||||||
for (i = 1, length = arguments.length; i < length; i++) {
|
for (i = 1, length = arguments.length; i < length; i++) {
|
||||||
rest[i - 1] = arguments[i];
|
rest[i - 1] = arguments[i];
|
||||||
}
|
}
|
||||||
@@ -1023,6 +1026,9 @@
|
|||||||
var docMode = document.documentMode;
|
var docMode = document.documentMode;
|
||||||
var oldIE = (isExplorer.exec(navigator.userAgent.toLowerCase()) && (!docMode || docMode <= 7));
|
var oldIE = (isExplorer.exec(navigator.userAgent.toLowerCase()) && (!docMode || docMode <= 7));
|
||||||
|
|
||||||
|
// Normalize root to always include trailing slash
|
||||||
|
if (!trailingSlash.test(this.options.root)) this.options.root += '/';
|
||||||
|
|
||||||
if (oldIE && this._wantsHashChange) {
|
if (oldIE && this._wantsHashChange) {
|
||||||
this.iframe = Backbone.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo('body')[0].contentWindow;
|
this.iframe = Backbone.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo('body')[0].contentWindow;
|
||||||
this.navigate(fragment);
|
this.navigate(fragment);
|
||||||
@@ -1042,7 +1048,7 @@
|
|||||||
// opened by a non-pushState browser.
|
// opened by a non-pushState browser.
|
||||||
this.fragment = fragment;
|
this.fragment = fragment;
|
||||||
var loc = this.location;
|
var loc = this.location;
|
||||||
var atRoot = (loc.pathname === this.options.root) && !loc.search;
|
var atRoot = (loc.pathname.replace(/[^/]$/, '$&/') === this.options.root) && !loc.search;
|
||||||
|
|
||||||
// If we've started off with a route from a `pushState`-enabled browser,
|
// If we've started off with a route from a `pushState`-enabled browser,
|
||||||
// but we're currently in a browser that doesn't support it...
|
// but we're currently in a browser that doesn't support it...
|
||||||
|
|||||||
52
vendor/backbone/test/router.js
vendored
52
vendor/backbone/test/router.js
vendored
@@ -20,9 +20,11 @@ $(document).ready(function() {
|
|||||||
_.extend(this, _.pick($('<a></a>', {href: href})[0],
|
_.extend(this, _.pick($('<a></a>', {href: href})[0],
|
||||||
'href',
|
'href',
|
||||||
'hash',
|
'hash',
|
||||||
|
'host',
|
||||||
'search',
|
'search',
|
||||||
'fragment',
|
'fragment',
|
||||||
'pathname'
|
'pathname',
|
||||||
|
'protocol'
|
||||||
));
|
));
|
||||||
// In IE, anchor.pathname does not contain a leading slash though
|
// In IE, anchor.pathname does not contain a leading slash though
|
||||||
// window.location.pathname does.
|
// window.location.pathname does.
|
||||||
@@ -318,4 +320,52 @@ $(document).ready(function() {
|
|||||||
strictEqual(Backbone.history.fragment, 'x');
|
strictEqual(Backbone.history.fragment, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("Router: Normalize root.", 1, function() {
|
||||||
|
Backbone.history.stop();
|
||||||
|
location.replace('http://example.com/root');
|
||||||
|
Backbone.history = new Backbone.History({
|
||||||
|
location: location,
|
||||||
|
history: {
|
||||||
|
pushState: function(state, title, url) {
|
||||||
|
strictEqual(url, '/root/fragment');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Backbone.history.start({
|
||||||
|
pushState: true,
|
||||||
|
root: '/root',
|
||||||
|
hashChange: false
|
||||||
|
});
|
||||||
|
Backbone.history.navigate('fragment');
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Router: Normalize root.", 1, function() {
|
||||||
|
Backbone.history.stop();
|
||||||
|
location.replace('http://example.com/root#fragment');
|
||||||
|
Backbone.history = new Backbone.History({
|
||||||
|
location: location,
|
||||||
|
history: {
|
||||||
|
pushState: function(state, title, url) {},
|
||||||
|
replaceState: function(state, title, url) {
|
||||||
|
strictEqual(url, 'http://example.com/root/fragment');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Backbone.history.start({
|
||||||
|
pushState: true,
|
||||||
|
root: '/root'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Router: Normalize root.", 1, function() {
|
||||||
|
Backbone.history.stop();
|
||||||
|
location.replace('http://example.com/root');
|
||||||
|
Backbone.history = new Backbone.History({location: location});
|
||||||
|
Backbone.history.loadUrl = function() { ok(true); };
|
||||||
|
Backbone.history.start({
|
||||||
|
pushState: true,
|
||||||
|
root: '/root'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
129
vendor/benchmark.js/benchmark.js
vendored
129
vendor/benchmark.js/benchmark.js
vendored
@@ -2410,8 +2410,7 @@
|
|||||||
'teardown': getSource(bench.teardown, preprocess('m$.teardown()'))
|
'teardown': getSource(bench.teardown, preprocess('m$.teardown()'))
|
||||||
};
|
};
|
||||||
|
|
||||||
var compiled = bench.compiled,
|
var count = bench.count = clone.count,
|
||||||
count = bench.count = clone.count,
|
|
||||||
decompilable = support.decompilation || stringable,
|
decompilable = support.decompilation || stringable,
|
||||||
id = bench.id,
|
id = bench.id,
|
||||||
isEmpty = !(source.fn || stringable),
|
isEmpty = !(source.fn || stringable),
|
||||||
@@ -2433,77 +2432,77 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!compiled) {
|
// Compile in setup/teardown functions and the test loop.
|
||||||
// compile in setup/teardown functions and the test loop
|
// Create a new compiled test, instead of using the cached `bench.compiled`,
|
||||||
compiled = bench.compiled = createFunction(preprocess('t$'), interpolate(
|
// to avoid potential engine optimizations enabled over the life of the test.
|
||||||
preprocess(deferred
|
var compiled = bench.compiled = createFunction(preprocess('t$'), interpolate(
|
||||||
? 'var d$=this,#{fnArg}=d$,m$=d$.benchmark._original,f$=m$.fn,su$=m$.setup,td$=m$.teardown;' +
|
preprocess(deferred
|
||||||
// when `deferred.cycles` is `0` then...
|
? 'var d$=this,#{fnArg}=d$,m$=d$.benchmark._original,f$=m$.fn,su$=m$.setup,td$=m$.teardown;' +
|
||||||
'if(!d$.cycles){' +
|
// when `deferred.cycles` is `0` then...
|
||||||
// set `deferred.fn`
|
'if(!d$.cycles){' +
|
||||||
'd$.fn=function(){var #{fnArg}=d$;if(typeof f$=="function"){try{#{fn}\n}catch(e$){f$(d$)}}else{#{fn}\n}};' +
|
// set `deferred.fn`
|
||||||
// set `deferred.teardown`
|
'd$.fn=function(){var #{fnArg}=d$;if(typeof f$=="function"){try{#{fn}\n}catch(e$){f$(d$)}}else{#{fn}\n}};' +
|
||||||
'd$.teardown=function(){d$.cycles=0;if(typeof td$=="function"){try{#{teardown}\n}catch(e$){td$()}}else{#{teardown}\n}};' +
|
// set `deferred.teardown`
|
||||||
// execute the benchmark's `setup`
|
'd$.teardown=function(){d$.cycles=0;if(typeof td$=="function"){try{#{teardown}\n}catch(e$){td$()}}else{#{teardown}\n}};' +
|
||||||
'if(typeof su$=="function"){try{#{setup}\n}catch(e$){su$()}}else{#{setup}\n};' +
|
// execute the benchmark's `setup`
|
||||||
// start timer
|
'if(typeof su$=="function"){try{#{setup}\n}catch(e$){su$()}}else{#{setup}\n};' +
|
||||||
't$.start(d$);' +
|
// start timer
|
||||||
// execute `deferred.fn` and return a dummy object
|
't$.start(d$);' +
|
||||||
'}d$.fn();return{}'
|
// execute `deferred.fn` and return a dummy object
|
||||||
|
'}d$.fn();return{}'
|
||||||
|
|
||||||
: 'var r$,s$,m$=this,f$=m$.fn,i$=m$.count,n$=t$.ns;#{setup}\n#{begin};' +
|
: 'var r$,s$,m$=this,f$=m$.fn,i$=m$.count,n$=t$.ns;#{setup}\n#{begin};' +
|
||||||
'while(i$--){#{fn}\n}#{end};#{teardown}\nreturn{elapsed:r$,uid:"#{uid}"}'),
|
'while(i$--){#{fn}\n}#{end};#{teardown}\nreturn{elapsed:r$,uid:"#{uid}"}'),
|
||||||
|
source
|
||||||
|
));
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (isEmpty) {
|
||||||
|
// Firefox may remove dead code from Function#toString results
|
||||||
|
// http://bugzil.la/536085
|
||||||
|
throw new Error('The test "' + name + '" is empty. This may be the result of dead code removal.');
|
||||||
|
}
|
||||||
|
else if (!deferred) {
|
||||||
|
// pretest to determine if compiled code is exits early, usually by a
|
||||||
|
// rogue `return` statement, by checking for a return object with the uid
|
||||||
|
bench.count = 1;
|
||||||
|
compiled = (compiled.call(bench, timer) || {}).uid == uid && compiled;
|
||||||
|
bench.count = count;
|
||||||
|
}
|
||||||
|
} catch(e) {
|
||||||
|
compiled = null;
|
||||||
|
clone.error = e || new Error(String(e));
|
||||||
|
bench.count = count;
|
||||||
|
}
|
||||||
|
// fallback when a test exits early or errors during pretest
|
||||||
|
if (decompilable && !compiled && !deferred && !isEmpty) {
|
||||||
|
compiled = createFunction(preprocess('t$'), interpolate(
|
||||||
|
preprocess(
|
||||||
|
(clone.error && !stringable
|
||||||
|
? 'var r$,s$,m$=this,f$=m$.fn,i$=m$.count'
|
||||||
|
: 'function f$(){#{fn}\n}var r$,s$,m$=this,i$=m$.count'
|
||||||
|
) +
|
||||||
|
',n$=t$.ns;#{setup}\n#{begin};m$.f$=f$;while(i$--){m$.f$()}#{end};' +
|
||||||
|
'delete m$.f$;#{teardown}\nreturn{elapsed:r$}'
|
||||||
|
),
|
||||||
source
|
source
|
||||||
));
|
));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (isEmpty) {
|
// pretest one more time to check for errors
|
||||||
// Firefox may remove dead code from Function#toString results
|
bench.count = 1;
|
||||||
// http://bugzil.la/536085
|
compiled.call(bench, timer);
|
||||||
throw new Error('The test "' + name + '" is empty. This may be the result of dead code removal.');
|
bench.compiled = compiled;
|
||||||
}
|
|
||||||
else if (!deferred) {
|
|
||||||
// pretest to determine if compiled code is exits early, usually by a
|
|
||||||
// rogue `return` statement, by checking for a return object with the uid
|
|
||||||
bench.count = 1;
|
|
||||||
compiled = (compiled.call(bench, timer) || {}).uid == uid && compiled;
|
|
||||||
bench.count = count;
|
|
||||||
}
|
|
||||||
} catch(e) {
|
|
||||||
compiled = null;
|
|
||||||
clone.error = e || new Error(String(e));
|
|
||||||
bench.count = count;
|
bench.count = count;
|
||||||
|
delete clone.error;
|
||||||
}
|
}
|
||||||
// fallback when a test exits early or errors during pretest
|
catch(e) {
|
||||||
if (decompilable && !compiled && !deferred && !isEmpty) {
|
bench.count = count;
|
||||||
compiled = createFunction(preprocess('t$'), interpolate(
|
if (clone.error) {
|
||||||
preprocess(
|
compiled = null;
|
||||||
(clone.error && !stringable
|
} else {
|
||||||
? 'var r$,s$,m$=this,f$=m$.fn,i$=m$.count'
|
|
||||||
: 'function f$(){#{fn}\n}var r$,s$,m$=this,i$=m$.count'
|
|
||||||
) +
|
|
||||||
',n$=t$.ns;#{setup}\n#{begin};m$.f$=f$;while(i$--){m$.f$()}#{end};' +
|
|
||||||
'delete m$.f$;#{teardown}\nreturn{elapsed:r$}'
|
|
||||||
),
|
|
||||||
source
|
|
||||||
));
|
|
||||||
|
|
||||||
try {
|
|
||||||
// pretest one more time to check for errors
|
|
||||||
bench.count = 1;
|
|
||||||
compiled.call(bench, timer);
|
|
||||||
bench.compiled = compiled;
|
bench.compiled = compiled;
|
||||||
bench.count = count;
|
clone.error = e || new Error(String(e));
|
||||||
delete clone.error;
|
|
||||||
}
|
|
||||||
catch(e) {
|
|
||||||
bench.count = count;
|
|
||||||
if (clone.error) {
|
|
||||||
compiled = null;
|
|
||||||
} else {
|
|
||||||
bench.compiled = compiled;
|
|
||||||
clone.error = e || new Error(String(e));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user