dist/up.js in upjs-rails-0.10.3 vs dist/up.js in upjs-rails-0.10.4
- old
+ new
@@ -23,11 +23,11 @@
(function() {
var slice = [].slice;
up.util = (function() {
- var $createElementFromSelector, ANIMATION_PROMISE_KEY, CONSOLE_PLACEHOLDERS, ajax, any, cache, castedAttr, clientSize, compact, config, contains, copy, copyAttributes, createElement, createElementFromHtml, createSelectorFromElement, cssAnimate, debug, detect, each, emptyJQuery, endsWith, error, escapePressed, extend, findWithSelf, finishCssAnimate, forceCompositing, get, identity, ifGiven, isArray, isBlank, isDeferred, isDefined, isElement, isFunction, isGiven, isHash, isJQuery, isMissing, isNull, isNumber, isObject, isPresent, isPromise, isStandardPort, isString, isUndefined, isUnmodifiedKeyEvent, isUnmodifiedMouseEvent, keys, last, locationFromXhr, map, measure, memoize, merge, methodFromXhr, multiSelector, nextFrame, normalizeMethod, normalizeUrl, nullJquery, once, only, option, options, presence, presentAttr, remove, resolvableWhen, resolvedDeferred, resolvedPromise, scrollbarWidth, select, setMissingAttrs, startsWith, stringifyConsoleArgs, temporaryCss, times, toArray, trim, unJquery, uniq, unwrapElement, warn;
+ var $createElementFromSelector, ANIMATION_PROMISE_KEY, CONSOLE_PLACEHOLDERS, ajax, any, cache, castedAttr, clientSize, compact, config, contains, copy, copyAttributes, createElement, createElementFromHtml, createSelectorFromElement, cssAnimate, debug, detect, each, emptyJQuery, endsWith, error, escapePressed, extend, findWithSelf, finishCssAnimate, forceCompositing, identity, ifGiven, isArray, isBlank, isDeferred, isDefined, isElement, isFunction, isGiven, isHash, isJQuery, isMissing, isNull, isNumber, isObject, isPresent, isPromise, isStandardPort, isString, isUndefined, isUnmodifiedKeyEvent, isUnmodifiedMouseEvent, keys, last, locationFromXhr, map, measure, memoize, merge, methodFromXhr, multiSelector, nextFrame, normalizeMethod, normalizeUrl, nullJquery, once, only, option, options, presence, presentAttr, remove, resolvableWhen, resolvedDeferred, resolvedPromise, scrollbarWidth, select, setMissingAttrs, startsWith, stringifyConsoleArgs, temporaryCss, times, toArray, trim, unJquery, uniq, unwrapElement, warn;
memoize = function(func) {
var cache, cached;
cache = void 0;
cached = false;
return function() {
@@ -39,15 +39,10 @@
cached = true;
return cache = func.apply(null, args);
}
};
};
- get = function(url, options) {
- options = options || {};
- options.url = url;
- return ajax(options);
- };
ajax = function(options) {
if (options.selector) {
options.headers = {
"X-Up-Selector": options.selector
};
@@ -880,11 +875,11 @@
will be discarded.
@param {String} [config.log]
A prefix for log entries printed by this cache object.
*/
cache = function(config) {
- var alias, clear, expiryMilis, isFresh, log, maxSize, normalizeStoreKey, set, store, timestamp;
+ var alias, clear, expiryMilis, get, isFresh, log, maxSize, normalizeStoreKey, set, store, timestamp;
store = void 0;
clear = function() {
return store = {};
};
clear();
@@ -984,17 +979,17 @@
if (fallback == null) {
fallback = void 0;
}
storeKey = normalizeStoreKey(key);
if (entry = store[storeKey]) {
- if (!isFresh(entry)) {
+ if (isFresh(entry)) {
+ log("Cache hit for %o", key);
+ return entry.value;
+ } else {
log("Discarding stale cache entry for %o", key);
remove(key);
return fallback;
- } else {
- log("Cache hit for %o", key);
- return entry.value;
}
} else {
log("Cache miss for %o", key);
return fallback;
}
@@ -1067,11 +1062,10 @@
normalizeUrl: normalizeUrl,
normalizeMethod: normalizeMethod,
createElementFromHtml: createElementFromHtml,
$createElementFromSelector: $createElementFromSelector,
createSelectorFromElement: createSelectorFromElement,
- get: get,
ajax: ajax,
extend: extend,
copy: copy,
merge: merge,
options: options,
@@ -3799,11 +3793,12 @@
delay = parseInt(u.presentAttr($link, 'up-delay')) || config.preloadDelay;
if (!$link.is($waitingLink)) {
$waitingLink = $link;
cancelPreloadDelay();
curriedPreload = function() {
- return preload($link);
+ preload($link);
+ return $waitingLink = null;
};
return startPreloadDelay(curriedPreload, delay);
}
};
startPreloadDelay = function(block, delay) {
@@ -3824,10 +3819,10 @@
if (isIdempotent({
method: method
})) {
u.debug("Preloading %o", $link);
options.preload = true;
- return up.link.follow($link, options);
+ return up.follow($link, options);
} else {
u.debug("Won't preload %o due to unsafe method %o", $link, method);
return u.resolvedPromise();
}
};