unpoly-rails 0.54.0 → 0.54.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of unpoly-rails might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Rakefile +19 -0
- data/dist/unpoly.js +380 -390
- data/dist/unpoly.min.js +3 -4
- data/lib/assets/javascripts/unpoly/{browser.coffee → browser.coffee.erb} +20 -20
- data/lib/assets/javascripts/unpoly/{bus.coffee → bus.coffee.erb} +17 -17
- data/lib/assets/javascripts/unpoly/classes/cache.coffee +2 -2
- data/lib/assets/javascripts/unpoly/classes/extract_plan.coffee +1 -1
- data/lib/assets/javascripts/unpoly/classes/motion_tracker.coffee +3 -3
- data/lib/assets/javascripts/unpoly/classes/request.coffee +9 -9
- data/lib/assets/javascripts/unpoly/classes/response.coffee +11 -11
- data/lib/assets/javascripts/unpoly/{dom.coffee → dom.coffee.erb} +18 -18
- data/lib/assets/javascripts/unpoly/feedback.coffee +8 -8
- data/lib/assets/javascripts/unpoly/{form.coffee → form.coffee.erb} +20 -20
- data/lib/assets/javascripts/unpoly/history.coffee +12 -12
- data/lib/assets/javascripts/unpoly/{layout.coffee → layout.coffee.erb} +23 -23
- data/lib/assets/javascripts/unpoly/{link.coffee → link.coffee.erb} +18 -18
- data/lib/assets/javascripts/unpoly/log.coffee +9 -9
- data/lib/assets/javascripts/unpoly/{modal.coffee → modal.coffee.erb} +22 -22
- data/lib/assets/javascripts/unpoly/motion.coffee +14 -14
- data/lib/assets/javascripts/unpoly/namespace.coffee.erb +1 -1
- data/lib/assets/javascripts/unpoly/{popup.coffee → popup.coffee.erb} +15 -15
- data/lib/assets/javascripts/unpoly/protocol.coffee +6 -6
- data/lib/assets/javascripts/unpoly/proxy.coffee +20 -20
- data/lib/assets/javascripts/unpoly/radio.coffee +4 -4
- data/lib/assets/javascripts/unpoly/rails.coffee +1 -1
- data/lib/assets/javascripts/unpoly/syntax.coffee +10 -10
- data/lib/assets/javascripts/unpoly/toast.coffee +1 -1
- data/lib/assets/javascripts/unpoly/tooltip.coffee +7 -7
- data/lib/assets/javascripts/unpoly/util.coffee +107 -107
- data/lib/unpoly/rails/version.rb +1 -1
- data/package.json +1 -1
- data/spec_app/Gemfile.lock +1 -1
- data/spec_app/config/application.rb +2 -0
- data/spec_app/spec/javascripts/helpers/to_have_unhandled_rejections.coffee +3 -0
- data/spec_app/spec/javascripts/up/form_spec.js.coffee +4 -3
- data/spec_app/spec/javascripts/up/link_spec.js.coffee +1 -1
- data/spec_app/spec/javascripts/up/proxy_spec.js.coffee +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a638be0eb0bec7b79fbd186dce420a721e34b780fd1b5f22a5e0a82ab3f5c64f
|
4
|
+
data.tar.gz: dda52bf9065aa7e49327dd3ba4c1007609797198508fb6e5e476f014e81b66c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9f145172d0afff7ef55080c38bc522e4b7ee0db583203ce68e8a4afbf39e6776ff286a0cbb3a5b6d17533b021c4499a11e3f5e135de58b4a984f5ac4bdd829c
|
7
|
+
data.tar.gz: 47e49f7c26c8c9065aa4ea93063ce2f486a30d156fe19cf3a6314b9ba7d85741e90fb488ff086d8e0245743a10aab35877b3ea0fe1516b30bf495504ab87fa5c
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,15 @@ Changes to this project will be documented in this file.
|
|
6
6
|
This project mostly adheres to [Semantic Versioning](http://semver.org/).
|
7
7
|
|
8
8
|
|
9
|
+
0.54.1
|
10
|
+
------
|
11
|
+
|
12
|
+
This release contains no new features, but will help you when using tools like Babel or Webpack:
|
13
|
+
|
14
|
+
- Unpoly now ship without any uses of [`eval()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval) in its JavaScript sources. Use of `eval()` had previously prevented minifiers from shortening local variables in some files. It could also trigger some bugs with Webpack 3.
|
15
|
+
- Documentation in Unpoly's JavaScript sources can no longer be confused with [JSDoc](http://usejsdoc.org/) comments. Unpoly does not use JSDoc, but some build pipelines eagerly look for JSDoc comments to generate type information.
|
16
|
+
|
17
|
+
|
9
18
|
0.54.0
|
10
19
|
------
|
11
20
|
|
data/Rakefile
CHANGED
@@ -43,6 +43,8 @@ end
|
|
43
43
|
namespace :publish do
|
44
44
|
desc 'Build release artifacts'
|
45
45
|
task :build do
|
46
|
+
ENV['JS_KNIFE'] = nil
|
47
|
+
|
46
48
|
Rake::Task['minified_assets:compile'].invoke
|
47
49
|
Unpoly::Tasks::SPROCKETS_MANIFESTS.each do |manifest|
|
48
50
|
source = "dist/#{manifest}"
|
@@ -50,9 +52,26 @@ namespace :publish do
|
|
50
52
|
File.rename(source, target)
|
51
53
|
end
|
52
54
|
Rake::Task['source_assets:compile'].invoke
|
55
|
+
Rake::Task['publish:validate_dist'].invoke
|
53
56
|
Rake::Task['npm:bump_version'].invoke
|
54
57
|
end
|
55
58
|
|
59
|
+
desc 'Validate build files in dist folder'
|
60
|
+
task :validate_dist do
|
61
|
+
script_paths = Dir['dist/*.js']
|
62
|
+
script_paths.each do |script_path|
|
63
|
+
content = File.read(script_path)
|
64
|
+
|
65
|
+
if content.size == 0
|
66
|
+
raise "Zero-byte build file: #{script_path}"
|
67
|
+
end
|
68
|
+
|
69
|
+
if content =~ /\beval\b/
|
70
|
+
raise "`eval` found in build file: #{script_path}"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
56
75
|
desc 'Commit and push build release artifacts'
|
57
76
|
task :commit do
|
58
77
|
commands = [
|
data/dist/unpoly.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
/***
|
3
3
|
@module up
|
4
4
|
*/
|
5
5
|
|
6
6
|
(function() {
|
7
7
|
window.up = {
|
8
|
-
version: "0.54.
|
8
|
+
version: "0.54.1",
|
9
9
|
renamedModule: function(oldName, newName) {
|
10
10
|
return typeof Object.defineProperty === "function" ? Object.defineProperty(up, oldName, {
|
11
11
|
get: function() {
|
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
}).call(this);
|
20
20
|
|
21
|
-
|
21
|
+
/***
|
22
22
|
Utility functions
|
23
23
|
=================
|
24
24
|
|
@@ -35,7 +35,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
35
35
|
|
36
36
|
up.util = (function($) {
|
37
37
|
|
38
|
-
|
38
|
+
/***
|
39
39
|
A function that does nothing.
|
40
40
|
|
41
41
|
@function up.util.noop
|
@@ -44,7 +44,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
44
44
|
var $createElementFromSelector, $createPlaceholder, $submittingButton, DivertibleChain, ESCAPE_HTML_ENTITY_MAP, all, always, any, appendRequestData, assign, assignPolyfill, attributeSelector, castedAttr, clientSize, compact, config, contains, copy, copyAttributes, createElementFromHtml, cssAnimate, detachWith, detect, documentHasVerticalScrollbar, each, escapeHtml, escapePressed, evalOption, except, extractOptions, fail, fixedToAbsolute, flatten, forceCompositing, forceRepaint, horizontalScreenHalf, identity, intersect, isArray, isBlank, isBodyDescendant, isCrossDomain, isDefined, isDetached, isElement, isFixed, isFormData, isFunction, isGiven, isJQuery, isMissing, isNull, isNumber, isObject, isOptions, isPresent, isPromise, isStandardPort, isString, isTruthy, isUndefined, isUnmodifiedKeyEvent, isUnmodifiedMouseEvent, last, map, margins, measure, memoize, merge, mergeRequestData, methodAllowsPayload, microtask, multiSelector, muteRejection, newDeferred, nextFrame, nonUpClasses, noop, normalizeMethod, normalizeUrl, nullJQuery, offsetParent, once, only, opacity, openConfig, option, options, parseUrl, pluckData, pluckKey, presence, presentAttr, previewable, promiseTimer, reject, rejectOnError, remove, renameKey, requestDataAsArray, requestDataAsQuery, requestDataFromForm, scrollbarWidth, select, selectInDynasty, selectInSubtree, selectorForElement, sequence, setMissingAttrs, setTimer, submittedValue, temporaryCss, times, toArray, trim, unJQuery, uniq, unresolvablePromise, unwrapElement, whenReady;
|
45
45
|
noop = $.noop;
|
46
46
|
|
47
|
-
|
47
|
+
/***
|
48
48
|
Ensures that the given function can only be called a single time.
|
49
49
|
Subsequent calls will return the return value of the first call.
|
50
50
|
|
@@ -70,7 +70,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
70
70
|
};
|
71
71
|
};
|
72
72
|
|
73
|
-
|
73
|
+
/***
|
74
74
|
Returns if the given port is the default port for the given protocol.
|
75
75
|
|
76
76
|
@function up.util.isStandardPort
|
@@ -81,7 +81,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
81
81
|
return ((port === "" || port === "80") && protocol === 'http:') || (port === "443" && protocol === 'https:');
|
82
82
|
};
|
83
83
|
|
84
|
-
|
84
|
+
/***
|
85
85
|
Normalizes relative paths and absolute paths to a full URL
|
86
86
|
that can be checked for equality with other normalized URLs.
|
87
87
|
|
@@ -126,7 +126,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
126
126
|
return currentUrl.protocol !== targetUrl.protocol || currentUrl.host !== targetUrl.host;
|
127
127
|
};
|
128
128
|
|
129
|
-
|
129
|
+
/***
|
130
130
|
Parses the given URL into components such as hostname and path.
|
131
131
|
|
132
132
|
If the given URL is not fully qualified, it is assumed to be relative
|
@@ -154,7 +154,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
154
154
|
return anchor;
|
155
155
|
};
|
156
156
|
|
157
|
-
|
157
|
+
/***
|
158
158
|
@function up.util.normalizeMethod
|
159
159
|
@internal
|
160
160
|
*/
|
@@ -166,7 +166,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
166
166
|
}
|
167
167
|
};
|
168
168
|
|
169
|
-
|
169
|
+
/***
|
170
170
|
@function up.util.methodAllowsPayload
|
171
171
|
@internal
|
172
172
|
*/
|
@@ -174,7 +174,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
174
174
|
return method !== 'GET' && method !== 'HEAD';
|
175
175
|
};
|
176
176
|
|
177
|
-
|
177
|
+
/***
|
178
178
|
@function $createElementFromSelector
|
179
179
|
@internal
|
180
180
|
*/
|
@@ -221,7 +221,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
221
221
|
return $root;
|
222
222
|
};
|
223
223
|
|
224
|
-
|
224
|
+
/***
|
225
225
|
@function $create
|
226
226
|
*/
|
227
227
|
$createPlaceholder = function(selector, container) {
|
@@ -235,7 +235,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
235
235
|
return $placeholder;
|
236
236
|
};
|
237
237
|
|
238
|
-
|
238
|
+
/***
|
239
239
|
Returns a CSS selector that matches the given element as good as possible.
|
240
240
|
|
241
241
|
This uses, in decreasing order of priority:
|
@@ -310,7 +310,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
310
310
|
return target;
|
311
311
|
};
|
312
312
|
|
313
|
-
|
313
|
+
/***
|
314
314
|
Merge the own properties of one or more `sources` into the `target` object.
|
315
315
|
|
316
316
|
@function up.util.assign
|
@@ -320,7 +320,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
320
320
|
*/
|
321
321
|
assign = Object.assign || assignPolyfill;
|
322
322
|
|
323
|
-
|
323
|
+
/***
|
324
324
|
Returns a new string with whitespace removed from the beginning
|
325
325
|
and end of the given string.
|
326
326
|
|
@@ -332,7 +332,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
332
332
|
*/
|
333
333
|
trim = $.trim;
|
334
334
|
|
335
|
-
|
335
|
+
/***
|
336
336
|
Calls the given function for each element (and, optional, index)
|
337
337
|
of the given array.
|
338
338
|
|
@@ -352,7 +352,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
352
352
|
return results;
|
353
353
|
};
|
354
354
|
|
355
|
-
|
355
|
+
/***
|
356
356
|
Translate all items in an array to new array of items.
|
357
357
|
|
358
358
|
@function up.util.map
|
@@ -365,7 +365,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
365
365
|
*/
|
366
366
|
map = each;
|
367
367
|
|
368
|
-
|
368
|
+
/***
|
369
369
|
Calls the given function for the given number of times.
|
370
370
|
|
371
371
|
@function up.util.times
|
@@ -382,7 +382,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
382
382
|
return results;
|
383
383
|
};
|
384
384
|
|
385
|
-
|
385
|
+
/***
|
386
386
|
Returns whether the given argument is `null`.
|
387
387
|
|
388
388
|
@function up.util.isNull
|
@@ -394,7 +394,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
394
394
|
return object === null;
|
395
395
|
};
|
396
396
|
|
397
|
-
|
397
|
+
/***
|
398
398
|
Returns whether the given argument is `undefined`.
|
399
399
|
|
400
400
|
@function up.util.isUndefined
|
@@ -406,7 +406,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
406
406
|
return object === void 0;
|
407
407
|
};
|
408
408
|
|
409
|
-
|
409
|
+
/***
|
410
410
|
Returns whether the given argument is not `undefined`.
|
411
411
|
|
412
412
|
@function up.util.isDefined
|
@@ -418,7 +418,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
418
418
|
return !isUndefined(object);
|
419
419
|
};
|
420
420
|
|
421
|
-
|
421
|
+
/***
|
422
422
|
Returns whether the given argument is either `undefined` or `null`.
|
423
423
|
|
424
424
|
Note that empty strings or zero are *not* considered to be "missing".
|
@@ -434,7 +434,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
434
434
|
return isUndefined(object) || isNull(object);
|
435
435
|
};
|
436
436
|
|
437
|
-
|
437
|
+
/***
|
438
438
|
Returns whether the given argument is neither `undefined` nor `null`.
|
439
439
|
|
440
440
|
Note that empty strings or zero *are* considered to be "given".
|
@@ -450,7 +450,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
450
450
|
return !isMissing(object);
|
451
451
|
};
|
452
452
|
|
453
|
-
|
453
|
+
/***
|
454
454
|
Return whether the given argument is considered to be blank.
|
455
455
|
|
456
456
|
This returns `true` for:
|
@@ -472,7 +472,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
472
472
|
return isMissing(object) || (isObject(object) && Object.keys(object).length === 0) || (object.length === 0);
|
473
473
|
};
|
474
474
|
|
475
|
-
|
475
|
+
/***
|
476
476
|
Returns the given argument if the argument is [present](/up.util.isPresent),
|
477
477
|
otherwise returns `undefined`.
|
478
478
|
|
@@ -494,7 +494,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
494
494
|
}
|
495
495
|
};
|
496
496
|
|
497
|
-
|
497
|
+
/***
|
498
498
|
Returns whether the given argument is not [blank](/up.util.isBlank).
|
499
499
|
|
500
500
|
@function up.util.isPresent
|
@@ -506,7 +506,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
506
506
|
return !isBlank(object);
|
507
507
|
};
|
508
508
|
|
509
|
-
|
509
|
+
/***
|
510
510
|
Returns whether the given argument is a function.
|
511
511
|
|
512
512
|
@function up.util.isFunction
|
@@ -518,7 +518,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
518
518
|
return typeof object === 'function';
|
519
519
|
};
|
520
520
|
|
521
|
-
|
521
|
+
/***
|
522
522
|
Returns whether the given argument is a string.
|
523
523
|
|
524
524
|
@function up.util.isString
|
@@ -530,7 +530,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
530
530
|
return typeof object === 'string' || object instanceof String;
|
531
531
|
};
|
532
532
|
|
533
|
-
|
533
|
+
/***
|
534
534
|
Returns whether the given argument is a number.
|
535
535
|
|
536
536
|
Note that this will check the argument's *type*.
|
@@ -545,7 +545,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
545
545
|
return typeof object === 'number' || object instanceof Number;
|
546
546
|
};
|
547
547
|
|
548
|
-
|
548
|
+
/***
|
549
549
|
Returns whether the given argument is an options hash,
|
550
550
|
|
551
551
|
Differently from [`up.util.isObject()`], this returns false for
|
@@ -560,7 +560,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
560
560
|
return typeof object === 'object' && !isNull(object) && !isJQuery(object) && !isPromise(object) && !isFormData(object) && !isArray(object);
|
561
561
|
};
|
562
562
|
|
563
|
-
|
563
|
+
/***
|
564
564
|
Returns whether the given argument is an object.
|
565
565
|
|
566
566
|
This also returns `true` for functions, which may behave like objects in JavaScript.
|
@@ -576,7 +576,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
576
576
|
return (typeOfResult === 'object' && !isNull(object)) || typeOfResult === 'function';
|
577
577
|
};
|
578
578
|
|
579
|
-
|
579
|
+
/***
|
580
580
|
Returns whether the given argument is a DOM element.
|
581
581
|
|
582
582
|
@function up.util.isElement
|
@@ -588,7 +588,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
588
588
|
return !!(object && object.nodeType === 1);
|
589
589
|
};
|
590
590
|
|
591
|
-
|
591
|
+
/***
|
592
592
|
Returns whether the given argument is a jQuery collection.
|
593
593
|
|
594
594
|
@function up.util.isJQuery
|
@@ -600,7 +600,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
600
600
|
return object instanceof jQuery;
|
601
601
|
};
|
602
602
|
|
603
|
-
|
603
|
+
/***
|
604
604
|
Returns whether the given argument is an object with a `then` method.
|
605
605
|
|
606
606
|
@function up.util.isPromise
|
@@ -612,7 +612,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
612
612
|
return isObject(object) && isFunction(object.then);
|
613
613
|
};
|
614
614
|
|
615
|
-
|
615
|
+
/***
|
616
616
|
Returns whether the given argument is an array.
|
617
617
|
|
618
618
|
@function up.util.isArray
|
@@ -622,7 +622,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
622
622
|
*/
|
623
623
|
isArray = Array.isArray;
|
624
624
|
|
625
|
-
|
625
|
+
/***
|
626
626
|
Returns whether the given argument is a `FormData` instance.
|
627
627
|
|
628
628
|
Always returns `false` in browsers that don't support `FormData`.
|
@@ -636,7 +636,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
636
636
|
return object instanceof FormData;
|
637
637
|
};
|
638
638
|
|
639
|
-
|
639
|
+
/***
|
640
640
|
Converts the given array-like argument into an array.
|
641
641
|
|
642
642
|
Returns the array.
|
@@ -650,7 +650,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
650
650
|
return Array.prototype.slice.call(object);
|
651
651
|
};
|
652
652
|
|
653
|
-
|
653
|
+
/***
|
654
654
|
Returns a shallow copy of the given array or object.
|
655
655
|
|
656
656
|
@function up.util.copy
|
@@ -669,7 +669,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
669
669
|
return object;
|
670
670
|
};
|
671
671
|
|
672
|
-
|
672
|
+
/***
|
673
673
|
If given a jQuery collection, returns the underlying array of DOM element.
|
674
674
|
If given any other argument, returns the argument unchanged.
|
675
675
|
|
@@ -685,7 +685,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
685
685
|
}
|
686
686
|
};
|
687
687
|
|
688
|
-
|
688
|
+
/***
|
689
689
|
Creates a new object by merging together the properties from the given objects.
|
690
690
|
|
691
691
|
@function up.util.merge
|
@@ -699,7 +699,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
699
699
|
return assign.apply(null, [{}].concat(slice.call(sources)));
|
700
700
|
};
|
701
701
|
|
702
|
-
|
702
|
+
/***
|
703
703
|
Creates an options hash from the given argument and some defaults.
|
704
704
|
|
705
705
|
The semantics of this function are confusing.
|
@@ -728,7 +728,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
728
728
|
return merged;
|
729
729
|
};
|
730
730
|
|
731
|
-
|
731
|
+
/***
|
732
732
|
Returns the first argument that is considered [given](/up.util.isGiven).
|
733
733
|
|
734
734
|
This function is useful when you have multiple option sources and the value can be boolean.
|
@@ -745,7 +745,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
745
745
|
return detect(args, isGiven);
|
746
746
|
};
|
747
747
|
|
748
|
-
|
748
|
+
/***
|
749
749
|
Passes each element in the given array to the given function.
|
750
750
|
Returns the first element for which the function returns a truthy value.
|
751
751
|
|
@@ -770,7 +770,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
770
770
|
return match;
|
771
771
|
};
|
772
772
|
|
773
|
-
|
773
|
+
/***
|
774
774
|
Returns whether the given function returns a truthy value
|
775
775
|
for any element in the given array.
|
776
776
|
|
@@ -793,7 +793,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
793
793
|
return match;
|
794
794
|
};
|
795
795
|
|
796
|
-
|
796
|
+
/***
|
797
797
|
Returns whether the given function returns a truthy value
|
798
798
|
for all elements in the given array.
|
799
799
|
|
@@ -816,7 +816,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
816
816
|
return match;
|
817
817
|
};
|
818
818
|
|
819
|
-
|
819
|
+
/***
|
820
820
|
Returns all elements from the given array that are
|
821
821
|
neither `null` or `undefined`.
|
822
822
|
|
@@ -829,7 +829,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
829
829
|
return select(array, isGiven);
|
830
830
|
};
|
831
831
|
|
832
|
-
|
832
|
+
/***
|
833
833
|
Returns the given array without duplicates.
|
834
834
|
|
835
835
|
@function up.util.uniq
|
@@ -849,7 +849,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
849
849
|
});
|
850
850
|
};
|
851
851
|
|
852
|
-
|
852
|
+
/***
|
853
853
|
Returns all elements from the given array that return
|
854
854
|
a truthy value when passed to the given function.
|
855
855
|
|
@@ -869,7 +869,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
869
869
|
return matches;
|
870
870
|
};
|
871
871
|
|
872
|
-
|
872
|
+
/***
|
873
873
|
Returns all elements from the given array that do not return
|
874
874
|
a truthy value when passed to the given function.
|
875
875
|
|
@@ -884,7 +884,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
884
884
|
});
|
885
885
|
};
|
886
886
|
|
887
|
-
|
887
|
+
/***
|
888
888
|
Returns the intersection of the given two arrays.
|
889
889
|
|
890
890
|
Implementation is not optimized. Don't use it for large arrays.
|
@@ -898,7 +898,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
898
898
|
});
|
899
899
|
};
|
900
900
|
|
901
|
-
|
901
|
+
/***
|
902
902
|
Returns the first [present](/up.util.isPresent) element attribute
|
903
903
|
among the given list of attribute names.
|
904
904
|
|
@@ -920,7 +920,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
920
920
|
return detect(values, isPresent);
|
921
921
|
};
|
922
922
|
|
923
|
-
|
923
|
+
/***
|
924
924
|
Waits for the given number of milliseconds, the runs the given callback.
|
925
925
|
|
926
926
|
Instead of `up.util.setTimer(0, fn)` you can also use [`up.util.nextFrame(fn)`](/up.util.nextFrame).
|
@@ -934,7 +934,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
934
934
|
return setTimeout(callback, millis);
|
935
935
|
};
|
936
936
|
|
937
|
-
|
937
|
+
/***
|
938
938
|
Schedules the given function to be called in the
|
939
939
|
next JavaScript execution frame.
|
940
940
|
|
@@ -946,7 +946,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
946
946
|
return setTimeout(block, 0);
|
947
947
|
};
|
948
948
|
|
949
|
-
|
949
|
+
/***
|
950
950
|
Queue a function to be executed in the next microtask.
|
951
951
|
|
952
952
|
@function up.util.queueMicrotask
|
@@ -957,7 +957,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
957
957
|
return Promise.resolve().then(task);
|
958
958
|
};
|
959
959
|
|
960
|
-
|
960
|
+
/***
|
961
961
|
Returns the last element of the given array.
|
962
962
|
|
963
963
|
@function up.util.last
|
@@ -968,7 +968,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
968
968
|
return array[array.length - 1];
|
969
969
|
};
|
970
970
|
|
971
|
-
|
971
|
+
/***
|
972
972
|
Measures the drawable area of the document.
|
973
973
|
|
974
974
|
@function up.util.clientSize
|
@@ -983,7 +983,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
983
983
|
};
|
984
984
|
};
|
985
985
|
|
986
|
-
|
986
|
+
/***
|
987
987
|
Returns the width of a scrollbar.
|
988
988
|
|
989
989
|
This only runs once per page load.
|
@@ -1010,7 +1010,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1010
1010
|
return width;
|
1011
1011
|
});
|
1012
1012
|
|
1013
|
-
|
1013
|
+
/***
|
1014
1014
|
Returns whether the given element is currently showing a vertical scrollbar.
|
1015
1015
|
|
1016
1016
|
@function up.util.documentHasVerticalScrollbar
|
@@ -1027,7 +1027,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1027
1027
|
return forcedScroll || (!forcedHidden && html.scrollHeight > html.clientHeight);
|
1028
1028
|
};
|
1029
1029
|
|
1030
|
-
|
1030
|
+
/***
|
1031
1031
|
Modifies the given function so it only runs once.
|
1032
1032
|
Subsequent calls will return the previous return value.
|
1033
1033
|
|
@@ -1049,7 +1049,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1049
1049
|
};
|
1050
1050
|
};
|
1051
1051
|
|
1052
|
-
|
1052
|
+
/***
|
1053
1053
|
Temporarily sets the CSS for the given element.
|
1054
1054
|
|
1055
1055
|
@function up.util.temporaryCss
|
@@ -1078,7 +1078,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1078
1078
|
}
|
1079
1079
|
};
|
1080
1080
|
|
1081
|
-
|
1081
|
+
/***
|
1082
1082
|
Forces the given jQuery element into an accelerated compositing layer.
|
1083
1083
|
|
1084
1084
|
@function up.util.forceCompositing
|
@@ -1101,7 +1101,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1101
1101
|
return memo;
|
1102
1102
|
};
|
1103
1103
|
|
1104
|
-
|
1104
|
+
/***
|
1105
1105
|
Forces a repaint of the given element.
|
1106
1106
|
|
1107
1107
|
@function up.util.forceRepaint
|
@@ -1113,7 +1113,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1113
1113
|
};
|
1114
1114
|
cssAnimate = function(elementOrSelector, lastFrame, opts) {};
|
1115
1115
|
|
1116
|
-
|
1116
|
+
/***
|
1117
1117
|
@internal
|
1118
1118
|
*/
|
1119
1119
|
margins = function(selectorOrElement) {
|
@@ -1128,7 +1128,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1128
1128
|
};
|
1129
1129
|
};
|
1130
1130
|
|
1131
|
-
|
1131
|
+
/***
|
1132
1132
|
Measures the given element.
|
1133
1133
|
|
1134
1134
|
@function up.util.measure
|
@@ -1181,7 +1181,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1181
1181
|
return box;
|
1182
1182
|
};
|
1183
1183
|
|
1184
|
-
|
1184
|
+
/***
|
1185
1185
|
Copies all attributes from the source element to the target element.
|
1186
1186
|
|
1187
1187
|
@function up.util.copyAttributes
|
@@ -1202,7 +1202,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1202
1202
|
return results;
|
1203
1203
|
};
|
1204
1204
|
|
1205
|
-
|
1205
|
+
/***
|
1206
1206
|
Looks for the given selector in the element and its descendants.
|
1207
1207
|
|
1208
1208
|
@function up.util.selectInSubtree
|
@@ -1212,7 +1212,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1212
1212
|
return $element.find(selector).addBack(selector);
|
1213
1213
|
};
|
1214
1214
|
|
1215
|
-
|
1215
|
+
/***
|
1216
1216
|
Looks for the given selector in the element, its descendants and its ancestors.
|
1217
1217
|
|
1218
1218
|
@function up.util.selectInDynasty
|
@@ -1225,7 +1225,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1225
1225
|
return $subtree.add($ancestors);
|
1226
1226
|
};
|
1227
1227
|
|
1228
|
-
|
1228
|
+
/***
|
1229
1229
|
Returns whether the given keyboard event involved the ESC key.
|
1230
1230
|
|
1231
1231
|
@function up.util.escapePressed
|
@@ -1235,7 +1235,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1235
1235
|
return event.keyCode === 27;
|
1236
1236
|
};
|
1237
1237
|
|
1238
|
-
|
1238
|
+
/***
|
1239
1239
|
Returns whether the given array or string contains the given element or substring.
|
1240
1240
|
|
1241
1241
|
@function up.util.contains
|
@@ -1247,7 +1247,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1247
1247
|
return arrayOrString.indexOf(elementOrSubstring) >= 0;
|
1248
1248
|
};
|
1249
1249
|
|
1250
|
-
|
1250
|
+
/***
|
1251
1251
|
@function up.util.castedAttr
|
1252
1252
|
@internal
|
1253
1253
|
*/
|
@@ -1266,7 +1266,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1266
1266
|
}
|
1267
1267
|
};
|
1268
1268
|
|
1269
|
-
|
1269
|
+
/***
|
1270
1270
|
Returns a copy of the given object that only contains
|
1271
1271
|
the given properties.
|
1272
1272
|
|
@@ -1288,7 +1288,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1288
1288
|
return filtered;
|
1289
1289
|
};
|
1290
1290
|
|
1291
|
-
|
1291
|
+
/***
|
1292
1292
|
Returns a copy of the given object that contains all except
|
1293
1293
|
the given properties.
|
1294
1294
|
|
@@ -1308,7 +1308,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1308
1308
|
return filtered;
|
1309
1309
|
};
|
1310
1310
|
|
1311
|
-
|
1311
|
+
/***
|
1312
1312
|
@function up.util.isUnmodifiedKeyEvent
|
1313
1313
|
@internal
|
1314
1314
|
*/
|
@@ -1316,7 +1316,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1316
1316
|
return !(event.metaKey || event.shiftKey || event.ctrlKey);
|
1317
1317
|
};
|
1318
1318
|
|
1319
|
-
|
1319
|
+
/***
|
1320
1320
|
@function up.util.isUnmodifiedMouseEvent
|
1321
1321
|
@internal
|
1322
1322
|
*/
|
@@ -1326,7 +1326,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1326
1326
|
return isLeftButton && isUnmodifiedKeyEvent(event);
|
1327
1327
|
};
|
1328
1328
|
|
1329
|
-
|
1329
|
+
/***
|
1330
1330
|
Returns a promise that will never be resolved.
|
1331
1331
|
|
1332
1332
|
@function up.util.unresolvablePromise
|
@@ -1336,7 +1336,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1336
1336
|
return new Promise(noop);
|
1337
1337
|
};
|
1338
1338
|
|
1339
|
-
|
1339
|
+
/***
|
1340
1340
|
Returns an empty jQuery collection.
|
1341
1341
|
|
1342
1342
|
@function up.util.nullJQuery
|
@@ -1346,7 +1346,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1346
1346
|
return $();
|
1347
1347
|
};
|
1348
1348
|
|
1349
|
-
|
1349
|
+
/***
|
1350
1350
|
On the given element, set attributes that are still missing.
|
1351
1351
|
|
1352
1352
|
@function up.util.setMissingAttrs
|
@@ -1366,7 +1366,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1366
1366
|
return results;
|
1367
1367
|
};
|
1368
1368
|
|
1369
|
-
|
1369
|
+
/***
|
1370
1370
|
Removes the given element from the given array.
|
1371
1371
|
|
1372
1372
|
This changes the given array.
|
@@ -1385,7 +1385,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1385
1385
|
}
|
1386
1386
|
};
|
1387
1387
|
|
1388
|
-
|
1388
|
+
/***
|
1389
1389
|
@function up.util.multiSelector
|
1390
1390
|
@internal
|
1391
1391
|
*/
|
@@ -1453,7 +1453,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1453
1453
|
return obj;
|
1454
1454
|
};
|
1455
1455
|
|
1456
|
-
|
1456
|
+
/***
|
1457
1457
|
If the given `value` is a function, calls the function with the given `args`.
|
1458
1458
|
Otherwise it just returns `value`.
|
1459
1459
|
|
@@ -1470,7 +1470,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1470
1470
|
}
|
1471
1471
|
};
|
1472
1472
|
|
1473
|
-
|
1473
|
+
/***
|
1474
1474
|
@function up.util.config
|
1475
1475
|
@param {Object|Function} blueprint
|
1476
1476
|
Default configuration options.
|
@@ -1486,7 +1486,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1486
1486
|
return hash;
|
1487
1487
|
};
|
1488
1488
|
|
1489
|
-
|
1489
|
+
/***
|
1490
1490
|
@function up.util.openConfig
|
1491
1491
|
@internal
|
1492
1492
|
*/
|
@@ -1508,7 +1508,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1508
1508
|
return hash;
|
1509
1509
|
};
|
1510
1510
|
|
1511
|
-
|
1511
|
+
/***
|
1512
1512
|
@function up.util.unwrapElement
|
1513
1513
|
@internal
|
1514
1514
|
*/
|
@@ -1523,7 +1523,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1523
1523
|
return parent.removeChild(wrapper);
|
1524
1524
|
};
|
1525
1525
|
|
1526
|
-
|
1526
|
+
/***
|
1527
1527
|
@function up.util.offsetParent
|
1528
1528
|
@internal
|
1529
1529
|
*/
|
@@ -1540,7 +1540,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1540
1540
|
return $match;
|
1541
1541
|
};
|
1542
1542
|
|
1543
|
-
|
1543
|
+
/***
|
1544
1544
|
Returns if the given element has a `fixed` position.
|
1545
1545
|
|
1546
1546
|
@function up.util.isFixed
|
@@ -1562,7 +1562,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1562
1562
|
}
|
1563
1563
|
};
|
1564
1564
|
|
1565
|
-
|
1565
|
+
/***
|
1566
1566
|
@function up.util.fixedToAbsolute
|
1567
1567
|
@internal
|
1568
1568
|
*/
|
@@ -1581,7 +1581,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1581
1581
|
});
|
1582
1582
|
};
|
1583
1583
|
|
1584
|
-
|
1584
|
+
/***
|
1585
1585
|
Normalizes the given params object to the form returned by
|
1586
1586
|
[`jQuery.serializeArray`](https://api.jquery.com/serializeArray/).
|
1587
1587
|
|
@@ -1614,7 +1614,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1614
1614
|
}
|
1615
1615
|
};
|
1616
1616
|
|
1617
|
-
|
1617
|
+
/***
|
1618
1618
|
Returns an URL-encoded query string for the given params object.
|
1619
1619
|
|
1620
1620
|
The returned string does **not** include a leading `?` character.
|
@@ -1660,7 +1660,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1660
1660
|
}
|
1661
1661
|
};
|
1662
1662
|
|
1663
|
-
|
1663
|
+
/***
|
1664
1664
|
Serializes the given form into a request data representation.
|
1665
1665
|
|
1666
1666
|
@function up.util.requestDataFromForm
|
@@ -1681,7 +1681,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1681
1681
|
return data;
|
1682
1682
|
};
|
1683
1683
|
|
1684
|
-
|
1684
|
+
/***
|
1685
1685
|
Adds a key/value pair to the given request data representation.
|
1686
1686
|
|
1687
1687
|
This mutates the given `data` if `data` is a `FormData`, an object
|
@@ -1718,7 +1718,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1718
1718
|
return data;
|
1719
1719
|
};
|
1720
1720
|
|
1721
|
-
|
1721
|
+
/***
|
1722
1722
|
Merges the request data in `source` into `target`.
|
1723
1723
|
Will modify the passed-in `target`.
|
1724
1724
|
|
@@ -1732,7 +1732,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1732
1732
|
return target;
|
1733
1733
|
};
|
1734
1734
|
|
1735
|
-
|
1735
|
+
/***
|
1736
1736
|
Throws a [JavaScript error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)
|
1737
1737
|
with the given message.
|
1738
1738
|
|
@@ -1779,7 +1779,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1779
1779
|
'"': '"'
|
1780
1780
|
};
|
1781
1781
|
|
1782
|
-
|
1782
|
+
/***
|
1783
1783
|
Escapes the given string of HTML by replacing control chars with their HTML entities.
|
1784
1784
|
|
1785
1785
|
@function up.util.escapeHtml
|
@@ -1839,7 +1839,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1839
1839
|
return arg;
|
1840
1840
|
};
|
1841
1841
|
|
1842
|
-
|
1842
|
+
/***
|
1843
1843
|
Returns whether the given element has been detached from the DOM
|
1844
1844
|
(or whether it was never attached).
|
1845
1845
|
|
@@ -1851,7 +1851,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1851
1851
|
return !jQuery.contains(document.documentElement, element);
|
1852
1852
|
};
|
1853
1853
|
|
1854
|
-
|
1854
|
+
/***
|
1855
1855
|
Given a function that will return a promise, returns a proxy function
|
1856
1856
|
with an additional `.promise` attribute.
|
1857
1857
|
|
@@ -1879,7 +1879,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1879
1879
|
return preview;
|
1880
1880
|
};
|
1881
1881
|
|
1882
|
-
|
1882
|
+
/***
|
1883
1883
|
A linear task queue whose (2..n)th tasks can be changed at any time.
|
1884
1884
|
|
1885
1885
|
@function up.util.DivertibleChain
|
@@ -1943,7 +1943,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1943
1943
|
|
1944
1944
|
})();
|
1945
1945
|
|
1946
|
-
|
1946
|
+
/***
|
1947
1947
|
@function up.util.submittedValue
|
1948
1948
|
@internal
|
1949
1949
|
*/
|
@@ -1957,7 +1957,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1957
1957
|
}
|
1958
1958
|
};
|
1959
1959
|
|
1960
|
-
|
1960
|
+
/***
|
1961
1961
|
@function up.util.sequence
|
1962
1962
|
@param {Array<Function>} functions...
|
1963
1963
|
@return {Function}
|
@@ -1975,7 +1975,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1975
1975
|
};
|
1976
1976
|
};
|
1977
1977
|
|
1978
|
-
|
1978
|
+
/***
|
1979
1979
|
@function up.util.promiseTimer
|
1980
1980
|
@internal
|
1981
1981
|
*/
|
@@ -1991,7 +1991,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
1991
1991
|
return promise;
|
1992
1992
|
};
|
1993
1993
|
|
1994
|
-
|
1994
|
+
/***
|
1995
1995
|
Returns `'left'` if the center of the given element is in the left 50% of the screen.
|
1996
1996
|
Otherwise returns `'right'`.
|
1997
1997
|
|
@@ -2011,7 +2011,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
2011
2011
|
}
|
2012
2012
|
};
|
2013
2013
|
|
2014
|
-
|
2014
|
+
/***
|
2015
2015
|
Like `$old.replaceWith($new)`, but keeps event handlers bound to `$old`.
|
2016
2016
|
|
2017
2017
|
Note that this is a memory leak unless you re-attach `$old` to the DOM aferwards.
|
@@ -2028,7 +2028,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
2028
2028
|
return $old;
|
2029
2029
|
};
|
2030
2030
|
|
2031
|
-
|
2031
|
+
/***
|
2032
2032
|
Flattens the given `array` a single level deep.
|
2033
2033
|
|
2034
2034
|
@function up.util.flatten
|
@@ -2052,7 +2052,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
2052
2052
|
return flattened;
|
2053
2053
|
};
|
2054
2054
|
|
2055
|
-
|
2055
|
+
/***
|
2056
2056
|
Returns whether the given value is truthy.
|
2057
2057
|
|
2058
2058
|
@function up.util.isTruthy
|
@@ -2062,7 +2062,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
2062
2062
|
return !!object;
|
2063
2063
|
};
|
2064
2064
|
|
2065
|
-
|
2065
|
+
/***
|
2066
2066
|
Sets the given callback as both fulfillment and rejection handler for the given promise.
|
2067
2067
|
|
2068
2068
|
@function up.util.always
|
@@ -2072,21 +2072,21 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
2072
2072
|
return promise.then(callback, callback);
|
2073
2073
|
};
|
2074
2074
|
|
2075
|
-
|
2075
|
+
/***
|
2076
2076
|
* Registers an empty rejection handler with the given promise.
|
2077
2077
|
* This prevents browsers from printing "Uncaught (in promise)" to the error
|
2078
2078
|
* console when the promise is rejection.
|
2079
|
-
|
2079
|
+
*
|
2080
2080
|
* This is helpful for event handlers where it is clear that no rejection
|
2081
2081
|
* handler will be registered:
|
2082
|
-
|
2082
|
+
*
|
2083
2083
|
* up.on('submit', 'form[up-target]', (event, $form) => {
|
2084
2084
|
* promise = up.submit($form)
|
2085
2085
|
* up.util.muteRejection(promise)
|
2086
2086
|
* })
|
2087
|
-
|
2087
|
+
*
|
2088
2088
|
* Does nothing if passed a missing value.
|
2089
|
-
|
2089
|
+
*
|
2090
2090
|
* @function up.util.muteRejection
|
2091
2091
|
* @param {Promise|undefined|null} promise
|
2092
2092
|
* @return {Promise}
|
@@ -2095,7 +2095,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
2095
2095
|
return promise != null ? promise["catch"](noop) : void 0;
|
2096
2096
|
};
|
2097
2097
|
|
2098
|
-
|
2098
|
+
/***
|
2099
2099
|
@function up.util.newDeferred
|
2100
2100
|
@internal
|
2101
2101
|
*/
|
@@ -2115,7 +2115,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
2115
2115
|
return nativePromise;
|
2116
2116
|
};
|
2117
2117
|
|
2118
|
-
|
2118
|
+
/***
|
2119
2119
|
Calls the given block. If the block throws an exception,
|
2120
2120
|
a rejected promise is returned instead.
|
2121
2121
|
|
@@ -2126,13 +2126,13 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
2126
2126
|
var error;
|
2127
2127
|
try {
|
2128
2128
|
return block();
|
2129
|
-
} catch (
|
2130
|
-
error =
|
2129
|
+
} catch (error1) {
|
2130
|
+
error = error1;
|
2131
2131
|
return Promise.reject(error);
|
2132
2132
|
}
|
2133
2133
|
};
|
2134
2134
|
|
2135
|
-
|
2135
|
+
/***
|
2136
2136
|
Returns whether the given element is a descendant of the `<body>` element.
|
2137
2137
|
|
2138
2138
|
@function up.util.isBodyDescendant
|
@@ -2270,14 +2270,14 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
2270
2270
|
u = up.util;
|
2271
2271
|
|
2272
2272
|
|
2273
|
-
|
2273
|
+
/***
|
2274
2274
|
@class up.Cache
|
2275
2275
|
@internal
|
2276
2276
|
*/
|
2277
2277
|
|
2278
2278
|
up.Cache = (function() {
|
2279
2279
|
|
2280
|
-
|
2280
|
+
/***
|
2281
2281
|
@constructor
|
2282
2282
|
@param {number|Function() :number} [config.size]
|
2283
2283
|
Maximum number of cache entries.
|
@@ -2668,7 +2668,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
2668
2668
|
};
|
2669
2669
|
|
2670
2670
|
|
2671
|
-
|
2671
|
+
/***
|
2672
2672
|
Example:
|
2673
2673
|
|
2674
2674
|
parseSelector('foo, bar:before', transition: 'cross-fade')
|
@@ -2930,7 +2930,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
2930
2930
|
}
|
2931
2931
|
|
2932
2932
|
|
2933
|
-
|
2933
|
+
/***
|
2934
2934
|
Finishes all animations in the given element's ancestors and descendants,
|
2935
2935
|
then calls the animator.
|
2936
2936
|
|
@@ -2949,7 +2949,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
2949
2949
|
};
|
2950
2950
|
|
2951
2951
|
|
2952
|
-
|
2952
|
+
/***
|
2953
2953
|
Calls the given animator to animate the given element.
|
2954
2954
|
|
2955
2955
|
The animation returned by the animator is tracked so it can be
|
@@ -2977,7 +2977,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
2977
2977
|
};
|
2978
2978
|
|
2979
2979
|
|
2980
|
-
|
2980
|
+
/***
|
2981
2981
|
@method finish
|
2982
2982
|
@param {jQuery} [elements]
|
2983
2983
|
If no element is given, finishes all animations in the documnet.
|
@@ -3089,7 +3089,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
3089
3089
|
u = up.util;
|
3090
3090
|
|
3091
3091
|
|
3092
|
-
|
3092
|
+
/***
|
3093
3093
|
Instances of `up.Request` normalizes properties of an [`AJAX request`](/up.request)
|
3094
3094
|
such as the requested URL, form parameters and HTTP method.
|
3095
3095
|
|
@@ -3100,7 +3100,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
3100
3100
|
extend(Request, superClass);
|
3101
3101
|
|
3102
3102
|
|
3103
|
-
|
3103
|
+
/***
|
3104
3104
|
The HTTP method for the request.
|
3105
3105
|
|
3106
3106
|
@property up.Request#method
|
@@ -3109,7 +3109,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
3109
3109
|
*/
|
3110
3110
|
|
3111
3111
|
|
3112
|
-
|
3112
|
+
/***
|
3113
3113
|
The URL for the request.
|
3114
3114
|
|
3115
3115
|
@property up.Request#url
|
@@ -3118,7 +3118,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
3118
3118
|
*/
|
3119
3119
|
|
3120
3120
|
|
3121
|
-
|
3121
|
+
/***
|
3122
3122
|
Parameters that should be sent as the request's payload.
|
3123
3123
|
|
3124
3124
|
Parameters may be passed as one of the following forms:
|
@@ -3133,7 +3133,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
3133
3133
|
*/
|
3134
3134
|
|
3135
3135
|
|
3136
|
-
|
3136
|
+
/***
|
3137
3137
|
The CSS selector that will be sent as an [`X-Up-Target` header](/up.protocol#optimizing-responses).
|
3138
3138
|
|
3139
3139
|
@property up.Request#target
|
@@ -3142,7 +3142,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
3142
3142
|
*/
|
3143
3143
|
|
3144
3144
|
|
3145
|
-
|
3145
|
+
/***
|
3146
3146
|
The CSS selector that will be sent as an [`X-Up-Fail-Target` header](/up.protocol#optimizing-responses).
|
3147
3147
|
|
3148
3148
|
@property up.Request#failTarget
|
@@ -3151,7 +3151,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
3151
3151
|
*/
|
3152
3152
|
|
3153
3153
|
|
3154
|
-
|
3154
|
+
/***
|
3155
3155
|
An object of additional HTTP headers.
|
3156
3156
|
|
3157
3157
|
@property up.Request#headers
|
@@ -3160,7 +3160,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
3160
3160
|
*/
|
3161
3161
|
|
3162
3162
|
|
3163
|
-
|
3163
|
+
/***
|
3164
3164
|
A timeout in milliseconds.
|
3165
3165
|
|
3166
3166
|
If [`up.proxy.config.maxRequests`](/up.proxy.config#config.maxRequests) is set,
|
@@ -3176,7 +3176,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
3176
3176
|
};
|
3177
3177
|
|
3178
3178
|
|
3179
|
-
|
3179
|
+
/***
|
3180
3180
|
@constructor up.Request
|
3181
3181
|
@param {string} [attributes]
|
3182
3182
|
*/
|
@@ -3390,7 +3390,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
3390
3390
|
u = up.util;
|
3391
3391
|
|
3392
3392
|
|
3393
|
-
|
3393
|
+
/***
|
3394
3394
|
Instances of `up.Response` describe the server response to an [`AJAX request`](/up.request).
|
3395
3395
|
|
3396
3396
|
\#\#\# Example
|
@@ -3407,7 +3407,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
3407
3407
|
extend(Response, superClass);
|
3408
3408
|
|
3409
3409
|
|
3410
|
-
|
3410
|
+
/***
|
3411
3411
|
The HTTP method used for the response.
|
3412
3412
|
|
3413
3413
|
This is usually the HTTP method used by the request.
|
@@ -3420,7 +3420,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
3420
3420
|
*/
|
3421
3421
|
|
3422
3422
|
|
3423
|
-
|
3423
|
+
/***
|
3424
3424
|
The URL used for the response.
|
3425
3425
|
|
3426
3426
|
This is usually the requested URL.
|
@@ -3433,7 +3433,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
3433
3433
|
*/
|
3434
3434
|
|
3435
3435
|
|
3436
|
-
|
3436
|
+
/***
|
3437
3437
|
The response body as a `string`.
|
3438
3438
|
|
3439
3439
|
@property up.Response#text
|
@@ -3442,7 +3442,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
3442
3442
|
*/
|
3443
3443
|
|
3444
3444
|
|
3445
|
-
|
3445
|
+
/***
|
3446
3446
|
The response's
|
3447
3447
|
[HTTP status code](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes)
|
3448
3448
|
as a `number`.
|
@@ -3455,7 +3455,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
3455
3455
|
*/
|
3456
3456
|
|
3457
3457
|
|
3458
|
-
|
3458
|
+
/***
|
3459
3459
|
The [request](/up.Request) that triggered this response.
|
3460
3460
|
|
3461
3461
|
@property up.Response#request
|
@@ -3464,7 +3464,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
3464
3464
|
*/
|
3465
3465
|
|
3466
3466
|
|
3467
|
-
|
3467
|
+
/***
|
3468
3468
|
The [`XMLHttpRequest`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest)
|
3469
3469
|
object that was used to create this response.
|
3470
3470
|
|
@@ -3474,7 +3474,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
3474
3474
|
*/
|
3475
3475
|
|
3476
3476
|
|
3477
|
-
|
3477
|
+
/***
|
3478
3478
|
A [document title pushed by the server](/up.protocol#pushing-a-document-title-to-the-client).
|
3479
3479
|
|
3480
3480
|
If the server pushed no title via HTTP header, this will be `undefined`.
|
@@ -3496,7 +3496,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
3496
3496
|
}
|
3497
3497
|
|
3498
3498
|
|
3499
|
-
|
3499
|
+
/***
|
3500
3500
|
Returns whether the server responded with a 2xx HTTP status.
|
3501
3501
|
|
3502
3502
|
@function up.Response#isSuccess
|
@@ -3509,7 +3509,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
3509
3509
|
};
|
3510
3510
|
|
3511
3511
|
|
3512
|
-
|
3512
|
+
/***
|
3513
3513
|
Returns whether the response was not [successful](/up.Request.prototype.isSuccess).
|
3514
3514
|
|
3515
3515
|
This also returns `true` when the request encountered a [fatal error](/up.Request.prototype.isFatalError)
|
@@ -3525,7 +3525,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
3525
3525
|
};
|
3526
3526
|
|
3527
3527
|
|
3528
|
-
|
3528
|
+
/***
|
3529
3529
|
Returns whether the request encountered a [fatal error](/up.Request.prototype.isFatalError)
|
3530
3530
|
like a timeout or loss of network connectivity.
|
3531
3531
|
|
@@ -3547,7 +3547,7 @@ that might save you from loading something like [Lodash](https://lodash.com/).
|
|
3547
3547
|
|
3548
3548
|
}).call(this);
|
3549
3549
|
|
3550
|
-
|
3550
|
+
/***
|
3551
3551
|
Browser support
|
3552
3552
|
===============
|
3553
3553
|
|
@@ -3572,7 +3572,7 @@ Internet Explorer 10 or lower
|
|
3572
3572
|
var CONSOLE_PLACEHOLDERS, canConsole, canCssTransition, canDOMParser, canFormData, canInputEvent, canPromise, canPushState, hash, isIE10OrWorse, isRecentJQuery, isSupported, navigate, polyfilledSessionStorage, popCookie, puts, sessionStorage, sprintf, sprintfWithFormattedArgs, stringifyArg, submitForm, u, url, whenConfirmed;
|
3573
3573
|
u = up.util;
|
3574
3574
|
|
3575
|
-
|
3575
|
+
/***
|
3576
3576
|
@method up.browser.navigate
|
3577
3577
|
@param {string} url
|
3578
3578
|
@param {string} [options.method='get']
|
@@ -3590,7 +3590,7 @@ Internet Explorer 10 or lower
|
|
3590
3590
|
return request.navigate();
|
3591
3591
|
};
|
3592
3592
|
|
3593
|
-
|
3593
|
+
/***
|
3594
3594
|
For mocking in specs.
|
3595
3595
|
|
3596
3596
|
@method submitForm
|
@@ -3599,7 +3599,7 @@ Internet Explorer 10 or lower
|
|
3599
3599
|
return $form.submit();
|
3600
3600
|
};
|
3601
3601
|
|
3602
|
-
|
3602
|
+
/***
|
3603
3603
|
A cross-browser way to interact with `console.log`, `console.error`, etc.
|
3604
3604
|
|
3605
3605
|
This function falls back to `console.log` if the output stream is not implemented.
|
@@ -3662,7 +3662,7 @@ Internet Explorer 10 or lower
|
|
3662
3662
|
return string;
|
3663
3663
|
};
|
3664
3664
|
|
3665
|
-
|
3665
|
+
/***
|
3666
3666
|
See https://developer.mozilla.org/en-US/docs/Web/API/Console#Using_string_substitutions
|
3667
3667
|
|
3668
3668
|
@function up.browser.sprintf
|
@@ -3674,7 +3674,7 @@ Internet Explorer 10 or lower
|
|
3674
3674
|
return sprintfWithFormattedArgs.apply(null, [u.identity, message].concat(slice.call(args)));
|
3675
3675
|
};
|
3676
3676
|
|
3677
|
-
|
3677
|
+
/***
|
3678
3678
|
@function up.browser.sprintfWithBounds
|
3679
3679
|
@internal
|
3680
3680
|
*/
|
@@ -3700,7 +3700,7 @@ Internet Explorer 10 or lower
|
|
3700
3700
|
return !window.atob;
|
3701
3701
|
});
|
3702
3702
|
|
3703
|
-
|
3703
|
+
/***
|
3704
3704
|
Returns whether this browser supports manipulation of the current URL
|
3705
3705
|
via [`history.pushState`](https://developer.mozilla.org/en-US/docs/Web/API/History/pushState).
|
3706
3706
|
|
@@ -3718,7 +3718,7 @@ Internet Explorer 10 or lower
|
|
3718
3718
|
return u.isDefined(history.pushState) && up.protocol.initialRequestMethod() === 'get';
|
3719
3719
|
};
|
3720
3720
|
|
3721
|
-
|
3721
|
+
/***
|
3722
3722
|
Returns whether this browser supports animation using
|
3723
3723
|
[CSS transitions](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Transitions).
|
3724
3724
|
|
@@ -3734,7 +3734,7 @@ Internet Explorer 10 or lower
|
|
3734
3734
|
return 'transition' in document.documentElement.style;
|
3735
3735
|
};
|
3736
3736
|
|
3737
|
-
|
3737
|
+
/***
|
3738
3738
|
Returns whether this browser supports the DOM event [`input`](https://developer.mozilla.org/de/docs/Web/Events/input).
|
3739
3739
|
|
3740
3740
|
@function up.browser.canInputEvent
|
@@ -3745,7 +3745,7 @@ Internet Explorer 10 or lower
|
|
3745
3745
|
return 'oninput' in document.createElement('input');
|
3746
3746
|
};
|
3747
3747
|
|
3748
|
-
|
3748
|
+
/***
|
3749
3749
|
Returns whether this browser supports promises.
|
3750
3750
|
|
3751
3751
|
@function up.browser.canPromise
|
@@ -3756,7 +3756,7 @@ Internet Explorer 10 or lower
|
|
3756
3756
|
return !!window.Promise;
|
3757
3757
|
};
|
3758
3758
|
|
3759
|
-
|
3759
|
+
/***
|
3760
3760
|
Returns whether this browser supports the [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData)
|
3761
3761
|
interface.
|
3762
3762
|
|
@@ -3768,7 +3768,7 @@ Internet Explorer 10 or lower
|
|
3768
3768
|
return !!window.FormData;
|
3769
3769
|
};
|
3770
3770
|
|
3771
|
-
|
3771
|
+
/***
|
3772
3772
|
Returns whether this browser supports the [`DOMParser`](https://developer.mozilla.org/en-US/docs/Web/API/DOMParser)
|
3773
3773
|
interface.
|
3774
3774
|
|
@@ -3780,7 +3780,7 @@ Internet Explorer 10 or lower
|
|
3780
3780
|
return !!window.DOMParser;
|
3781
3781
|
};
|
3782
3782
|
|
3783
|
-
|
3783
|
+
/***
|
3784
3784
|
Returns whether this browser supports the [`debugging console`](https://developer.mozilla.org/en-US/docs/Web/API/Console).
|
3785
3785
|
|
3786
3786
|
@function up.browser.canConsole
|
@@ -3799,7 +3799,7 @@ Internet Explorer 10 or lower
|
|
3799
3799
|
return major >= 2 || (major === 1 && minor >= 9);
|
3800
3800
|
};
|
3801
3801
|
|
3802
|
-
|
3802
|
+
/***
|
3803
3803
|
Returns and deletes a cookie with the given name
|
3804
3804
|
Inspired by Turbolinks: https://github.com/rails/turbolinks/blob/83d4b3d2c52a681f07900c28adb28bc8da604733/lib/assets/javascripts/turbolinks.coffee#L292
|
3805
3805
|
|
@@ -3815,7 +3815,7 @@ Internet Explorer 10 or lower
|
|
3815
3815
|
return value;
|
3816
3816
|
};
|
3817
3817
|
|
3818
|
-
|
3818
|
+
/***
|
3819
3819
|
@function up,browser.whenConfirmed
|
3820
3820
|
@return {Promise}
|
3821
3821
|
@param {string} options.confirm
|
@@ -3830,7 +3830,7 @@ Internet Explorer 10 or lower
|
|
3830
3830
|
}
|
3831
3831
|
};
|
3832
3832
|
|
3833
|
-
|
3833
|
+
/***
|
3834
3834
|
Returns whether Unpoly supports the current browser.
|
3835
3835
|
|
3836
3836
|
If this returns `false` Unpoly will prevent itself from [booting](/up.boot)
|
@@ -3846,18 +3846,18 @@ Internet Explorer 10 or lower
|
|
3846
3846
|
return !isIE10OrWorse() && isRecentJQuery() && canConsole() && canDOMParser() && canFormData() && canCssTransition() && canInputEvent() && canPromise();
|
3847
3847
|
};
|
3848
3848
|
|
3849
|
-
|
3849
|
+
/***
|
3850
3850
|
@internal
|
3851
3851
|
*/
|
3852
3852
|
sessionStorage = u.memoize(function() {
|
3853
3853
|
try {
|
3854
3854
|
return window.sessionStorage;
|
3855
|
-
} catch (
|
3855
|
+
} catch (error) {
|
3856
3856
|
return polyfilledSessionStorage();
|
3857
3857
|
}
|
3858
3858
|
});
|
3859
3859
|
|
3860
|
-
|
3860
|
+
/***
|
3861
3861
|
@internal
|
3862
3862
|
*/
|
3863
3863
|
polyfilledSessionStorage = function() {
|
@@ -3873,7 +3873,7 @@ Internet Explorer 10 or lower
|
|
3873
3873
|
};
|
3874
3874
|
};
|
3875
3875
|
|
3876
|
-
|
3876
|
+
/***
|
3877
3877
|
Returns `'foo'` if the hash is `'#foo'`.
|
3878
3878
|
|
3879
3879
|
Returns undefined if the hash is `'#'`, `''` or `undefined`.
|
@@ -3890,7 +3890,6 @@ Internet Explorer 10 or lower
|
|
3890
3890
|
return u.presence(value);
|
3891
3891
|
};
|
3892
3892
|
return {
|
3893
|
-
knife: eval(typeof Knife !== "undefined" && Knife !== null ? Knife.point : void 0),
|
3894
3893
|
url: url,
|
3895
3894
|
navigate: navigate,
|
3896
3895
|
submitForm: submitForm,
|
@@ -3909,7 +3908,7 @@ Internet Explorer 10 or lower
|
|
3909
3908
|
|
3910
3909
|
}).call(this);
|
3911
3910
|
|
3912
|
-
|
3911
|
+
/***
|
3913
3912
|
Events
|
3914
3913
|
======
|
3915
3914
|
|
@@ -3968,7 +3967,7 @@ This improves jQuery's [`on`](http://api.jquery.com/on/) in multiple ways:
|
|
3968
3967
|
nextUpDescriptionNumber = 0;
|
3969
3968
|
renamedEvents = {};
|
3970
3969
|
|
3971
|
-
|
3970
|
+
/***
|
3972
3971
|
Convert an Unpoly style listener (second argument is the event target
|
3973
3972
|
as a jQuery collection) to a vanilla jQuery listener
|
3974
3973
|
|
@@ -3983,7 +3982,7 @@ This improves jQuery's [`on`](http://api.jquery.com/on/) in multiple ways:
|
|
3983
3982
|
};
|
3984
3983
|
};
|
3985
3984
|
|
3986
|
-
|
3985
|
+
/***
|
3987
3986
|
Converts an argument list for `up.on()` to an argument list for `jQuery.on`.
|
3988
3987
|
This involves rewriting the listener signature in the last argument slot.
|
3989
3988
|
|
@@ -4022,7 +4021,7 @@ This improves jQuery's [`on`](http://api.jquery.com/on/) in multiple ways:
|
|
4022
4021
|
return description[0] = events.join(' ');
|
4023
4022
|
};
|
4024
4023
|
|
4025
|
-
|
4024
|
+
/***
|
4026
4025
|
Listens to an event on `document`.
|
4027
4026
|
|
4028
4027
|
The given event listener which will be executed whenever the
|
@@ -4127,7 +4126,7 @@ This improves jQuery's [`on`](http://api.jquery.com/on/) in multiple ways:
|
|
4127
4126
|
};
|
4128
4127
|
};
|
4129
4128
|
|
4130
|
-
|
4129
|
+
/***
|
4131
4130
|
Unbinds an event listener previously bound with [`up.on()`](/up.on).
|
4132
4131
|
|
4133
4132
|
\#\#\# Example
|
@@ -4168,7 +4167,7 @@ This improves jQuery's [`on`](http://api.jquery.com/on/) in multiple ways:
|
|
4168
4167
|
return u.last(upDescription)._descriptionNumber;
|
4169
4168
|
};
|
4170
4169
|
|
4171
|
-
|
4170
|
+
/***
|
4172
4171
|
Emits a event with the given name and properties.
|
4173
4172
|
|
4174
4173
|
The event will be triggered as a jQuery event on `document`.
|
@@ -4244,7 +4243,7 @@ This improves jQuery's [`on`](http://api.jquery.com/on/) in multiple ways:
|
|
4244
4243
|
}
|
4245
4244
|
};
|
4246
4245
|
|
4247
|
-
|
4246
|
+
/***
|
4248
4247
|
[Emits an event](/up.emit) and returns whether no listener
|
4249
4248
|
has prevented the default action.
|
4250
4249
|
|
@@ -4263,7 +4262,7 @@ This improves jQuery's [`on`](http://api.jquery.com/on/) in multiple ways:
|
|
4263
4262
|
return !event.isDefaultPrevented();
|
4264
4263
|
};
|
4265
4264
|
|
4266
|
-
|
4265
|
+
/***
|
4267
4266
|
[Emits](/up.emit) the given event and returns a promise
|
4268
4267
|
that will be fulfilled if no listener has prevented the default action.
|
4269
4268
|
|
@@ -4289,7 +4288,7 @@ This improves jQuery's [`on`](http://api.jquery.com/on/) in multiple ways:
|
|
4289
4288
|
});
|
4290
4289
|
};
|
4291
4290
|
|
4292
|
-
|
4291
|
+
/***
|
4293
4292
|
Registers an event listener to be called when the user
|
4294
4293
|
presses the `Escape` key.
|
4295
4294
|
|
@@ -4308,7 +4307,7 @@ This improves jQuery's [`on`](http://api.jquery.com/on/) in multiple ways:
|
|
4308
4307
|
});
|
4309
4308
|
};
|
4310
4309
|
|
4311
|
-
|
4310
|
+
/***
|
4312
4311
|
Stops the given event from propagating and prevents the default action.
|
4313
4312
|
|
4314
4313
|
@function up.bus.haltEvent
|
@@ -4320,7 +4319,7 @@ This improves jQuery's [`on`](http://api.jquery.com/on/) in multiple ways:
|
|
4320
4319
|
return event.preventDefault();
|
4321
4320
|
};
|
4322
4321
|
|
4323
|
-
|
4322
|
+
/***
|
4324
4323
|
@function up.bus.consumeAction
|
4325
4324
|
@internal
|
4326
4325
|
*/
|
@@ -4334,7 +4333,7 @@ This improves jQuery's [`on`](http://api.jquery.com/on/) in multiple ways:
|
|
4334
4333
|
}
|
4335
4334
|
};
|
4336
4335
|
|
4337
|
-
|
4336
|
+
/***
|
4338
4337
|
Makes a snapshot of the currently registered event listeners,
|
4339
4338
|
to later be restored through [`up.bus.reset()`](/up.bus.reset).
|
4340
4339
|
|
@@ -4366,7 +4365,7 @@ This improves jQuery's [`on`](http://api.jquery.com/on/) in multiple ways:
|
|
4366
4365
|
return results;
|
4367
4366
|
};
|
4368
4367
|
|
4369
|
-
|
4368
|
+
/***
|
4370
4369
|
Resets Unpoly to the state when it was booted.
|
4371
4370
|
All custom event handlers, animations, etc. that have been registered
|
4372
4371
|
will be discarded.
|
@@ -4386,7 +4385,7 @@ This improves jQuery's [`on`](http://api.jquery.com/on/) in multiple ways:
|
|
4386
4385
|
return up.protocol.reset();
|
4387
4386
|
};
|
4388
4387
|
|
4389
|
-
|
4388
|
+
/***
|
4390
4389
|
This event is [emitted](/up.emit) when Unpoly is [reset](/up.reset) during unit tests.
|
4391
4390
|
|
4392
4391
|
@event up:framework:reset
|
@@ -4396,7 +4395,7 @@ This improves jQuery's [`on`](http://api.jquery.com/on/) in multiple ways:
|
|
4396
4395
|
return renamedEvents[oldEvent] = newEvent;
|
4397
4396
|
};
|
4398
4397
|
|
4399
|
-
|
4398
|
+
/***
|
4400
4399
|
Boots the Unpoly framework.
|
4401
4400
|
|
4402
4401
|
**This is called automatically** by including the Unpoly JavaScript files.
|
@@ -4430,7 +4429,7 @@ This improves jQuery's [`on`](http://api.jquery.com/on/) in multiple ways:
|
|
4430
4429
|
}
|
4431
4430
|
};
|
4432
4431
|
|
4433
|
-
|
4432
|
+
/***
|
4434
4433
|
This event is [emitted](/up.emit) when Unpoly [starts to boot](/up.boot).
|
4435
4434
|
|
4436
4435
|
@event up:framework:boot
|
@@ -4439,7 +4438,6 @@ This improves jQuery's [`on`](http://api.jquery.com/on/) in multiple ways:
|
|
4439
4438
|
live('up:framework:booted', snapshot);
|
4440
4439
|
live('up:framework:reset', resetBus);
|
4441
4440
|
return {
|
4442
|
-
knife: eval(typeof Knife !== "undefined" && Knife !== null ? Knife.point : void 0),
|
4443
4441
|
on: live,
|
4444
4442
|
off: unbind,
|
4445
4443
|
emit: emit,
|
@@ -4466,7 +4464,7 @@ This improves jQuery's [`on`](http://api.jquery.com/on/) in multiple ways:
|
|
4466
4464
|
|
4467
4465
|
}).call(this);
|
4468
4466
|
|
4469
|
-
|
4467
|
+
/***
|
4470
4468
|
Server protocol
|
4471
4469
|
===============
|
4472
4470
|
|
@@ -4648,7 +4646,7 @@ an existing cookie should be deleted.
|
|
4648
4646
|
var config, csrfParam, csrfToken, initialRequestMethod, locationFromXhr, methodFromXhr, reset, titleFromXhr, u;
|
4649
4647
|
u = up.util;
|
4650
4648
|
|
4651
|
-
|
4649
|
+
/***
|
4652
4650
|
@function up.protocol.locationFromXhr
|
4653
4651
|
@internal
|
4654
4652
|
*/
|
@@ -4656,7 +4654,7 @@ an existing cookie should be deleted.
|
|
4656
4654
|
return xhr.getResponseHeader(config.locationHeader) || xhr.responseURL;
|
4657
4655
|
};
|
4658
4656
|
|
4659
|
-
|
4657
|
+
/***
|
4660
4658
|
@function up.protocol.titleFromXhr
|
4661
4659
|
@internal
|
4662
4660
|
*/
|
@@ -4664,7 +4662,7 @@ an existing cookie should be deleted.
|
|
4664
4662
|
return xhr.getResponseHeader(config.titleHeader);
|
4665
4663
|
};
|
4666
4664
|
|
4667
|
-
|
4665
|
+
/***
|
4668
4666
|
@function up.protocol.methodFromXhr
|
4669
4667
|
@internal
|
4670
4668
|
*/
|
@@ -4675,7 +4673,7 @@ an existing cookie should be deleted.
|
|
4675
4673
|
}
|
4676
4674
|
};
|
4677
4675
|
|
4678
|
-
|
4676
|
+
/***
|
4679
4677
|
Server-side companion libraries like unpoly-rails set this cookie so we
|
4680
4678
|
have a way to detect the request method of the initial page load.
|
4681
4679
|
There is no JavaScript API for this.
|
@@ -4690,7 +4688,7 @@ an existing cookie should be deleted.
|
|
4690
4688
|
});
|
4691
4689
|
up.bus.on('up:framework:booted', initialRequestMethod);
|
4692
4690
|
|
4693
|
-
|
4691
|
+
/***
|
4694
4692
|
Configures strings used in the optional [server protocol](/up.protocol).
|
4695
4693
|
|
4696
4694
|
@property up.protocol.config
|
@@ -4776,7 +4774,7 @@ an existing cookie should be deleted.
|
|
4776
4774
|
|
4777
4775
|
}).call(this);
|
4778
4776
|
|
4779
|
-
|
4777
|
+
/***
|
4780
4778
|
Logging
|
4781
4779
|
=======
|
4782
4780
|
|
@@ -4801,7 +4799,7 @@ The output can be configured using the [`up.log.config`](/up.log.config) propert
|
|
4801
4799
|
b = up.browser;
|
4802
4800
|
SESSION_KEY_ENABLED = 'up.log.enabled';
|
4803
4801
|
|
4804
|
-
|
4802
|
+
/***
|
4805
4803
|
Configures the logging output on the developer console.
|
4806
4804
|
|
4807
4805
|
@property up.log.config
|
@@ -4832,7 +4830,7 @@ The output can be configured using the [`up.log.config`](/up.log.config) propert
|
|
4832
4830
|
return "" + config.prefix + message;
|
4833
4831
|
};
|
4834
4832
|
|
4835
|
-
|
4833
|
+
/***
|
4836
4834
|
Prints a debugging message to the browser console.
|
4837
4835
|
|
4838
4836
|
@function up.log.debug
|
@@ -4848,7 +4846,7 @@ The output can be configured using the [`up.log.config`](/up.log.config) propert
|
|
4848
4846
|
}
|
4849
4847
|
};
|
4850
4848
|
|
4851
|
-
|
4849
|
+
/***
|
4852
4850
|
Prints a logging message to the browser console.
|
4853
4851
|
|
4854
4852
|
@function up.puts
|
@@ -4864,7 +4862,7 @@ The output can be configured using the [`up.log.config`](/up.log.config) propert
|
|
4864
4862
|
}
|
4865
4863
|
};
|
4866
4864
|
|
4867
|
-
|
4865
|
+
/***
|
4868
4866
|
@function up.log.warn
|
4869
4867
|
@internal
|
4870
4868
|
*/
|
@@ -4876,7 +4874,7 @@ The output can be configured using the [`up.log.config`](/up.log.config) propert
|
|
4876
4874
|
}
|
4877
4875
|
};
|
4878
4876
|
|
4879
|
-
|
4877
|
+
/***
|
4880
4878
|
- Makes sure the group always closes
|
4881
4879
|
- Does not make a group if the message is nil
|
4882
4880
|
|
@@ -4902,7 +4900,7 @@ The output can be configured using the [`up.log.config`](/up.log.config) propert
|
|
4902
4900
|
}
|
4903
4901
|
};
|
4904
4902
|
|
4905
|
-
|
4903
|
+
/***
|
4906
4904
|
@function up.log.error
|
4907
4905
|
@internal
|
4908
4906
|
*/
|
@@ -4930,7 +4928,7 @@ The output can be configured using the [`up.log.config`](/up.log.config) propert
|
|
4930
4928
|
return config.enabled = value;
|
4931
4929
|
};
|
4932
4930
|
|
4933
|
-
|
4931
|
+
/***
|
4934
4932
|
Makes future Unpoly events print vast amounts of debugging information to the developer console.
|
4935
4933
|
|
4936
4934
|
Debugging information includes which elements are being [compiled](/up.syntax)
|
@@ -4943,7 +4941,7 @@ The output can be configured using the [`up.log.config`](/up.log.config) propert
|
|
4943
4941
|
return setEnabled(true);
|
4944
4942
|
};
|
4945
4943
|
|
4946
|
-
|
4944
|
+
/***
|
4947
4945
|
Prevents future Unpoly events from printing vast amounts of debugging information to the developer console.
|
4948
4946
|
|
4949
4947
|
Errors will still be printed, even with logging disabled.
|
@@ -4970,7 +4968,7 @@ The output can be configured using the [`up.log.config`](/up.log.config) propert
|
|
4970
4968
|
|
4971
4969
|
}).call(this);
|
4972
4970
|
|
4973
|
-
|
4971
|
+
/***
|
4974
4972
|
Toast alerts
|
4975
4973
|
============
|
4976
4974
|
|
@@ -5046,7 +5044,7 @@ Toast alerts
|
|
5046
5044
|
|
5047
5045
|
}).call(this);
|
5048
5046
|
|
5049
|
-
|
5047
|
+
/***
|
5050
5048
|
Custom JavaScript
|
5051
5049
|
=================
|
5052
5050
|
|
@@ -5088,7 +5086,7 @@ or when a matching fragment is [inserted via AJAX](/up.link) later.
|
|
5088
5086
|
compilers = [];
|
5089
5087
|
macros = [];
|
5090
5088
|
|
5091
|
-
|
5089
|
+
/***
|
5092
5090
|
Registers a function to be called whenever an element with
|
5093
5091
|
the given selector is inserted into the DOM.
|
5094
5092
|
|
@@ -5277,7 +5275,7 @@ or when a matching fragment is [inserted via AJAX](/up.link) later.
|
|
5277
5275
|
return insertCompiler(compilers, selector, options, callback);
|
5278
5276
|
};
|
5279
5277
|
|
5280
|
-
|
5278
|
+
/***
|
5281
5279
|
Registers a [compiler](/up.compiler) that is run before all other compilers.
|
5282
5280
|
|
5283
5281
|
You can use `up.macro()` to register a compiler that sets other UJS attributes.
|
@@ -5373,7 +5371,7 @@ or when a matching fragment is [inserted via AJAX](/up.link) later.
|
|
5373
5371
|
return addDestructor($jqueryElement, returnValue);
|
5374
5372
|
};
|
5375
5373
|
|
5376
|
-
|
5374
|
+
/***
|
5377
5375
|
Tries to find a list of destructors in a compiler's return value.
|
5378
5376
|
|
5379
5377
|
@param {Object} returnValue
|
@@ -5403,7 +5401,7 @@ or when a matching fragment is [inserted via AJAX](/up.link) later.
|
|
5403
5401
|
return $element.removeClass(DESTRUCTIBLE_CLASS);
|
5404
5402
|
};
|
5405
5403
|
|
5406
|
-
|
5404
|
+
/***
|
5407
5405
|
Applies all compilers on the given element and its descendants.
|
5408
5406
|
Unlike [`up.hello()`](/up.hello), this doesn't emit any events.
|
5409
5407
|
|
@@ -5458,7 +5456,7 @@ or when a matching fragment is [inserted via AJAX](/up.link) later.
|
|
5458
5456
|
});
|
5459
5457
|
};
|
5460
5458
|
|
5461
|
-
|
5459
|
+
/***
|
5462
5460
|
Runs any destroyers on the given fragment and its descendants.
|
5463
5461
|
Unlike [`up.destroy()`](/up.destroy), this doesn't emit any events
|
5464
5462
|
and does not remove the element from the DOM.
|
@@ -5470,7 +5468,7 @@ or when a matching fragment is [inserted via AJAX](/up.link) later.
|
|
5470
5468
|
return prepareClean($fragment)();
|
5471
5469
|
};
|
5472
5470
|
|
5473
|
-
|
5471
|
+
/***
|
5474
5472
|
@function up.syntax.prepareClean
|
5475
5473
|
@param {jQuery} $fragment
|
5476
5474
|
@return {Function}
|
@@ -5486,7 +5484,7 @@ or when a matching fragment is [inserted via AJAX](/up.link) later.
|
|
5486
5484
|
return u.sequence.apply(u, destructors);
|
5487
5485
|
};
|
5488
5486
|
|
5489
|
-
|
5487
|
+
/***
|
5490
5488
|
Checks if the given element has an [`up-data`](/up-data) attribute.
|
5491
5489
|
If yes, parses the attribute value as JSON and returns the parsed object.
|
5492
5490
|
|
@@ -5511,7 +5509,7 @@ or when a matching fragment is [inserted via AJAX](/up.link) later.
|
|
5511
5509
|
@stable
|
5512
5510
|
*/
|
5513
5511
|
|
5514
|
-
|
5512
|
+
/***
|
5515
5513
|
If an element with an `up-data` attribute enters the DOM,
|
5516
5514
|
Unpoly will parse the JSON and pass the resulting object to any matching
|
5517
5515
|
[`up.compiler()`](/up.compiler) handlers.
|
@@ -5565,7 +5563,7 @@ or when a matching fragment is [inserted via AJAX](/up.link) later.
|
|
5565
5563
|
}
|
5566
5564
|
};
|
5567
5565
|
|
5568
|
-
|
5566
|
+
/***
|
5569
5567
|
Resets the list of registered compiler directives to the
|
5570
5568
|
moment when the framework was booted.
|
5571
5569
|
|
@@ -5599,7 +5597,7 @@ or when a matching fragment is [inserted via AJAX](/up.link) later.
|
|
5599
5597
|
|
5600
5598
|
}).call(this);
|
5601
5599
|
|
5602
|
-
|
5600
|
+
/***
|
5603
5601
|
History
|
5604
5602
|
========
|
5605
5603
|
|
@@ -5615,7 +5613,7 @@ In an Unpoly app, every page has an URL.
|
|
5615
5613
|
var buildState, config, currentUrl, isCurrentUrl, manipulate, nextPreviousUrl, normalizeUrl, observeNewUrl, pop, previousUrl, push, register, replace, reset, restoreStateOnPop, u;
|
5616
5614
|
u = up.util;
|
5617
5615
|
|
5618
|
-
|
5616
|
+
/***
|
5619
5617
|
Configures behavior when the user goes back or forward in browser history.
|
5620
5618
|
|
5621
5619
|
@property up.history.config
|
@@ -5633,7 +5631,7 @@ In an Unpoly app, every page has an URL.
|
|
5633
5631
|
restoreScroll: true
|
5634
5632
|
});
|
5635
5633
|
|
5636
|
-
|
5634
|
+
/***
|
5637
5635
|
Returns the previous URL in the browser history.
|
5638
5636
|
|
5639
5637
|
Note that this will only work reliably for history changes that
|
@@ -5656,7 +5654,7 @@ In an Unpoly app, every page has an URL.
|
|
5656
5654
|
return u.normalizeUrl(url, normalizeOptions);
|
5657
5655
|
};
|
5658
5656
|
|
5659
|
-
|
5657
|
+
/***
|
5660
5658
|
Returns a normalized URL for the current history entry.
|
5661
5659
|
|
5662
5660
|
@function up.history.url
|
@@ -5673,7 +5671,7 @@ In an Unpoly app, every page has an URL.
|
|
5673
5671
|
return normalizeUrl(url, normalizeOptions) === currentUrl(normalizeOptions);
|
5674
5672
|
};
|
5675
5673
|
|
5676
|
-
|
5674
|
+
/***
|
5677
5675
|
Remembers the given URL so we can offer `up.history.previousUrl()`.
|
5678
5676
|
|
5679
5677
|
@function observeNewUrl
|
@@ -5687,7 +5685,7 @@ In an Unpoly app, every page has an URL.
|
|
5687
5685
|
return nextPreviousUrl = url;
|
5688
5686
|
};
|
5689
5687
|
|
5690
|
-
|
5688
|
+
/***
|
5691
5689
|
Replaces the current history entry and updates the
|
5692
5690
|
browser's location bar with the given URL.
|
5693
5691
|
|
@@ -5707,7 +5705,7 @@ In an Unpoly app, every page has an URL.
|
|
5707
5705
|
return manipulate('replaceState', url);
|
5708
5706
|
};
|
5709
5707
|
|
5710
|
-
|
5708
|
+
/***
|
5711
5709
|
Adds a new history entry and updates the browser's
|
5712
5710
|
address bar with the given URL.
|
5713
5711
|
|
@@ -5749,7 +5747,7 @@ In an Unpoly app, every page has an URL.
|
|
5749
5747
|
}
|
5750
5748
|
};
|
5751
5749
|
|
5752
|
-
|
5750
|
+
/***
|
5753
5751
|
This event is [emitted](/up.emit) before a new history entry is added.
|
5754
5752
|
|
5755
5753
|
@event up:history:push
|
@@ -5760,7 +5758,7 @@ In an Unpoly app, every page has an URL.
|
|
5760
5758
|
@experimental
|
5761
5759
|
*/
|
5762
5760
|
|
5763
|
-
|
5761
|
+
/***
|
5764
5762
|
This event is [emitted](/up.emit) after a new history entry has been added.
|
5765
5763
|
|
5766
5764
|
@event up:history:pushed
|
@@ -5823,7 +5821,7 @@ In an Unpoly app, every page has an URL.
|
|
5823
5821
|
return restoreStateOnPop(state);
|
5824
5822
|
};
|
5825
5823
|
|
5826
|
-
|
5824
|
+
/***
|
5827
5825
|
This event is [emitted](/up.emit) before a history entry will be restored.
|
5828
5826
|
|
5829
5827
|
History entries are restored when the user uses the *Back* or *Forward* button.
|
@@ -5834,7 +5832,7 @@ In an Unpoly app, every page has an URL.
|
|
5834
5832
|
@internal
|
5835
5833
|
*/
|
5836
5834
|
|
5837
|
-
|
5835
|
+
/***
|
5838
5836
|
This event is [emitted](/up.emit) after a history entry has been restored.
|
5839
5837
|
|
5840
5838
|
History entries are restored when the user uses the *Back* or *Forward* button.
|
@@ -5858,7 +5856,7 @@ In an Unpoly app, every page has an URL.
|
|
5858
5856
|
}
|
5859
5857
|
}
|
5860
5858
|
|
5861
|
-
|
5859
|
+
/***
|
5862
5860
|
Changes the link's destination so it points to the previous URL.
|
5863
5861
|
|
5864
5862
|
Note that this will *not* call `location.back()`, but will set
|
@@ -5909,7 +5907,7 @@ In an Unpoly app, every page has an URL.
|
|
5909
5907
|
|
5910
5908
|
}).call(this);
|
5911
5909
|
|
5912
|
-
|
5910
|
+
/***
|
5913
5911
|
Application layout
|
5914
5912
|
==================
|
5915
5913
|
|
@@ -5937,7 +5935,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
5937
5935
|
var anchoredRight, config, finishScrolling, firstHashTarget, fixedChildren, lastScrollTops, measureObstruction, reset, restoreScroll, reveal, revealHash, revealOrRestoreScroll, revealSelector, saveScroll, scroll, scrollAbruptlyNow, scrollTopKey, scrollTops, scrollWithAnimateNow, scrollableElementForViewport, scrollingTracker, u, viewportOf, viewportSelector, viewports, viewportsWithin;
|
5938
5936
|
u = up.util;
|
5939
5937
|
|
5940
|
-
|
5938
|
+
/***
|
5941
5939
|
Configures the application layout.
|
5942
5940
|
|
5943
5941
|
@property up.layout.config
|
@@ -5991,7 +5989,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
5991
5989
|
return scrollingTracker.finish();
|
5992
5990
|
};
|
5993
5991
|
|
5994
|
-
|
5992
|
+
/***
|
5995
5993
|
Scrolls the given viewport to the given Y-position.
|
5996
5994
|
|
5997
5995
|
A "viewport" is an element that has scrollbars, e.g. `<body>` or
|
@@ -6075,7 +6073,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
6075
6073
|
return Promise.resolve();
|
6076
6074
|
};
|
6077
6075
|
|
6078
|
-
|
6076
|
+
/***
|
6079
6077
|
Finishes scrolling animations in the given element, its ancestors or its descendants.
|
6080
6078
|
|
6081
6079
|
@function up.layout.finishScrolling
|
@@ -6089,7 +6087,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
6089
6087
|
return scrollingTracker.finish($scrollable);
|
6090
6088
|
};
|
6091
6089
|
|
6092
|
-
|
6090
|
+
/***
|
6093
6091
|
@function up.layout.anchoredRight
|
6094
6092
|
@internal
|
6095
6093
|
*/
|
@@ -6097,7 +6095,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
6097
6095
|
return u.multiSelector(config.anchoredRight).select();
|
6098
6096
|
};
|
6099
6097
|
|
6100
|
-
|
6098
|
+
/***
|
6101
6099
|
@function measureObstruction
|
6102
6100
|
@return {Object}
|
6103
6101
|
@internal
|
@@ -6139,7 +6137,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
6139
6137
|
};
|
6140
6138
|
};
|
6141
6139
|
|
6142
|
-
|
6140
|
+
/***
|
6143
6141
|
Scroll's the given element's viewport so the first rows of the
|
6144
6142
|
element are visible for the user.
|
6145
6143
|
|
@@ -6236,7 +6234,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
6236
6234
|
});
|
6237
6235
|
};
|
6238
6236
|
|
6239
|
-
|
6237
|
+
/***
|
6240
6238
|
[Reveals](/up.reveal) an element matching the `#hash` in the current URL.
|
6241
6239
|
|
6242
6240
|
Other than the default behavior found in browsers, `up.revealHash` works with
|
@@ -6262,7 +6260,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
6262
6260
|
return u.multiSelector(config.viewports);
|
6263
6261
|
};
|
6264
6262
|
|
6265
|
-
|
6263
|
+
/***
|
6266
6264
|
Returns the viewport for the given element.
|
6267
6265
|
|
6268
6266
|
Throws an error if no viewport could be found.
|
@@ -6284,7 +6282,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
6284
6282
|
return $viewport;
|
6285
6283
|
};
|
6286
6284
|
|
6287
|
-
|
6285
|
+
/***
|
6288
6286
|
Returns a jQuery collection of all the viewports contained within the
|
6289
6287
|
given selector or element.
|
6290
6288
|
|
@@ -6299,7 +6297,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
6299
6297
|
return viewportSelector().selectInSubtree($element);
|
6300
6298
|
};
|
6301
6299
|
|
6302
|
-
|
6300
|
+
/***
|
6303
6301
|
Returns a jQuery collection of all the viewports on the screen.
|
6304
6302
|
|
6305
6303
|
@function up.layout.viewports
|
@@ -6318,7 +6316,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
6318
6316
|
}
|
6319
6317
|
};
|
6320
6318
|
|
6321
|
-
|
6319
|
+
/***
|
6322
6320
|
Returns a hash with scroll positions.
|
6323
6321
|
|
6324
6322
|
Each key in the hash is a viewport selector. The corresponding
|
@@ -6348,7 +6346,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
6348
6346
|
return topsBySelector;
|
6349
6347
|
};
|
6350
6348
|
|
6351
|
-
|
6349
|
+
/***
|
6352
6350
|
@function up.layout.fixedChildren
|
6353
6351
|
@internal
|
6354
6352
|
*/
|
@@ -6369,7 +6367,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
6369
6367
|
return $elements;
|
6370
6368
|
};
|
6371
6369
|
|
6372
|
-
|
6370
|
+
/***
|
6373
6371
|
Saves the top scroll positions of all the
|
6374
6372
|
viewports configured in [`up.layout.config.viewports`](/up.layout.config).
|
6375
6373
|
|
@@ -6394,7 +6392,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
6394
6392
|
return lastScrollTops.set(url, tops);
|
6395
6393
|
};
|
6396
6394
|
|
6397
|
-
|
6395
|
+
/***
|
6398
6396
|
Restores [previously saved](/up.layout.saveScroll) scroll positions of viewports
|
6399
6397
|
viewports configured in [`up.layout.config.viewports`](/up.layout.config).
|
6400
6398
|
|
@@ -6438,7 +6436,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
6438
6436
|
});
|
6439
6437
|
};
|
6440
6438
|
|
6441
|
-
|
6439
|
+
/***
|
6442
6440
|
@function up.layout.revealOrRestoreScroll
|
6443
6441
|
@param {boolean} [options.restoreScroll]
|
6444
6442
|
@param {boolean|string} [options.reveal]
|
@@ -6472,7 +6470,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
6472
6470
|
return Promise.resolve();
|
6473
6471
|
};
|
6474
6472
|
|
6475
|
-
|
6473
|
+
/***
|
6476
6474
|
@internal
|
6477
6475
|
*/
|
6478
6476
|
revealSelector = function(selector, options) {
|
@@ -6483,7 +6481,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
6483
6481
|
return selector;
|
6484
6482
|
};
|
6485
6483
|
|
6486
|
-
|
6484
|
+
/***
|
6487
6485
|
Marks this element as a scrolling container ("viewport").
|
6488
6486
|
|
6489
6487
|
Apply this attribute if your app uses a custom panel layout with fixed positioning
|
@@ -6536,7 +6534,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
6536
6534
|
@stable
|
6537
6535
|
*/
|
6538
6536
|
|
6539
|
-
|
6537
|
+
/***
|
6540
6538
|
Marks this element as being fixed to the top edge of the screen
|
6541
6539
|
using `position: fixed`.
|
6542
6540
|
|
@@ -6556,7 +6554,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
6556
6554
|
@stable
|
6557
6555
|
*/
|
6558
6556
|
|
6559
|
-
|
6557
|
+
/***
|
6560
6558
|
Marks this element as being fixed to the bottom edge of the screen
|
6561
6559
|
using `position: fixed`.
|
6562
6560
|
|
@@ -6576,7 +6574,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
6576
6574
|
@stable
|
6577
6575
|
*/
|
6578
6576
|
|
6579
|
-
|
6577
|
+
/***
|
6580
6578
|
Marks this element as being anchored to the right edge of the screen,
|
6581
6579
|
typically fixed navigation bars.
|
6582
6580
|
|
@@ -6611,7 +6609,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
6611
6609
|
@stable
|
6612
6610
|
*/
|
6613
6611
|
|
6614
|
-
|
6612
|
+
/***
|
6615
6613
|
@function up.layout.firstHashTarget
|
6616
6614
|
@internal
|
6617
6615
|
*/
|
@@ -6623,7 +6621,6 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
6623
6621
|
up.on('up:app:booted', revealHash);
|
6624
6622
|
up.on('up:framework:reset', reset);
|
6625
6623
|
return {
|
6626
|
-
knife: eval(typeof Knife !== "undefined" && Knife !== null ? Knife.point : void 0),
|
6627
6624
|
reveal: reveal,
|
6628
6625
|
revealHash: revealHash,
|
6629
6626
|
firstHashTarget: firstHashTarget,
|
@@ -6649,7 +6646,7 @@ Unpoly will automatically be aware of sticky Bootstrap components such as
|
|
6649
6646
|
|
6650
6647
|
}).call(this);
|
6651
6648
|
|
6652
|
-
|
6649
|
+
/***
|
6653
6650
|
Fragment update API
|
6654
6651
|
===================
|
6655
6652
|
|
@@ -6668,7 +6665,7 @@ is built from these functions. You can use them to extend Unpoly from your
|
|
6668
6665
|
var autofocus, bestMatchingSteps, bestPreflightSelector, config, destroy, detectScriptFixes, emitFragmentInserted, emitFragmentKept, extract, findKeepPlan, first, firstInLayer, firstInPriority, fixScripts, hello, isRealElement, layerOf, matchesLayer, parseResponseDoc, processResponse, reload, replace, reset, resolveSelector, setSource, shouldExtractTitle, shouldLogDestruction, shouldSwapElementsDirectly, source, swapElements, swapElementsDirectly, transferKeepableElements, u, updateHistoryAndTitle;
|
6669
6666
|
u = up.util;
|
6670
6667
|
|
6671
|
-
|
6668
|
+
/***
|
6672
6669
|
Configures defaults for fragment insertion.
|
6673
6670
|
|
6674
6671
|
@property up.dom.config
|
@@ -6703,7 +6700,7 @@ is built from these functions. You can use them to extend Unpoly from your
|
|
6703
6700
|
return $element.attr("up-source", sourceUrl);
|
6704
6701
|
};
|
6705
6702
|
|
6706
|
-
|
6703
|
+
/***
|
6707
6704
|
Returns the URL the given element was retrieved from.
|
6708
6705
|
|
6709
6706
|
@method up.dom.source
|
@@ -6716,7 +6713,7 @@ is built from these functions. You can use them to extend Unpoly from your
|
|
6716
6713
|
return u.presence($element.attr("up-source")) || up.browser.url();
|
6717
6714
|
};
|
6718
6715
|
|
6719
|
-
|
6716
|
+
/***
|
6720
6717
|
Resolves the given CSS selector (which might contain `&` references)
|
6721
6718
|
to a full CSS selector without ampersands.
|
6722
6719
|
|
@@ -6748,7 +6745,7 @@ is built from these functions. You can use them to extend Unpoly from your
|
|
6748
6745
|
return selector;
|
6749
6746
|
};
|
6750
6747
|
|
6751
|
-
|
6748
|
+
/***
|
6752
6749
|
Replaces elements on the current page with corresponding elements
|
6753
6750
|
from a new page fetched from the server.
|
6754
6751
|
|
@@ -6926,8 +6923,8 @@ is built from these functions. You can use them to extend Unpoly from your
|
|
6926
6923
|
try {
|
6927
6924
|
improvedTarget = bestPreflightSelector(selectorOrElement, successOptions);
|
6928
6925
|
improvedFailTarget = bestPreflightSelector(options.failTarget, failureOptions);
|
6929
|
-
} catch (
|
6930
|
-
e =
|
6926
|
+
} catch (error) {
|
6927
|
+
e = error;
|
6931
6928
|
return Promise.reject(e);
|
6932
6929
|
}
|
6933
6930
|
request = {
|
@@ -6963,7 +6960,7 @@ is built from these functions. You can use them to extend Unpoly from your
|
|
6963
6960
|
return promise;
|
6964
6961
|
};
|
6965
6962
|
|
6966
|
-
|
6963
|
+
/***
|
6967
6964
|
@internal
|
6968
6965
|
*/
|
6969
6966
|
processResponse = function(isSuccess, selector, response, options) {
|
@@ -7015,7 +7012,7 @@ is built from these functions. You can use them to extend Unpoly from your
|
|
7015
7012
|
return !(options.title === false || u.isString(options.title) || (options.history === false && options.title !== true));
|
7016
7013
|
};
|
7017
7014
|
|
7018
|
-
|
7015
|
+
/***
|
7019
7016
|
Updates a selector on the current page with the
|
7020
7017
|
same selector from the given HTML string.
|
7021
7018
|
|
@@ -7273,7 +7270,7 @@ is built from these functions. You can use them to extend Unpoly from your
|
|
7273
7270
|
}
|
7274
7271
|
};
|
7275
7272
|
|
7276
|
-
|
7273
|
+
/***
|
7277
7274
|
Elements with an `up-keep` attribute will be persisted during
|
7278
7275
|
[fragment updates](/a-up-target).
|
7279
7276
|
|
@@ -7323,7 +7320,7 @@ is built from these functions. You can use them to extend Unpoly from your
|
|
7323
7320
|
@stable
|
7324
7321
|
*/
|
7325
7322
|
|
7326
|
-
|
7323
|
+
/***
|
7327
7324
|
This event is [emitted](/up.emit) before an existing element is [kept](/up-keep) during
|
7328
7325
|
a page update.
|
7329
7326
|
|
@@ -7344,7 +7341,7 @@ is built from these functions. You can use them to extend Unpoly from your
|
|
7344
7341
|
@stable
|
7345
7342
|
*/
|
7346
7343
|
|
7347
|
-
|
7344
|
+
/***
|
7348
7345
|
This event is [emitted](/up.emit) when an existing element has been [kept](/up-keep)
|
7349
7346
|
during a page update.
|
7350
7347
|
|
@@ -7362,7 +7359,7 @@ is built from these functions. You can use them to extend Unpoly from your
|
|
7362
7359
|
@stable
|
7363
7360
|
*/
|
7364
7361
|
|
7365
|
-
|
7362
|
+
/***
|
7366
7363
|
Compiles a page fragment that has been inserted into the DOM
|
7367
7364
|
by external code.
|
7368
7365
|
|
@@ -7407,7 +7404,7 @@ is built from these functions. You can use them to extend Unpoly from your
|
|
7407
7404
|
return $element;
|
7408
7405
|
};
|
7409
7406
|
|
7410
|
-
|
7407
|
+
/***
|
7411
7408
|
When a page fragment has been [inserted or updated](/up.replace),
|
7412
7409
|
this event is [emitted](/up.emit) on the fragment.
|
7413
7410
|
|
@@ -7452,7 +7449,7 @@ is built from these functions. You can use them to extend Unpoly from your
|
|
7452
7449
|
return $element.closest(unreal).length === 0;
|
7453
7450
|
};
|
7454
7451
|
|
7455
|
-
|
7452
|
+
/***
|
7456
7453
|
Returns the first element matching the given selector, but
|
7457
7454
|
ignores elements that are being [destroyed](/up.destroy) or [transitioned](/up.morph).
|
7458
7455
|
|
@@ -7535,7 +7532,7 @@ is built from these functions. You can use them to extend Unpoly from your
|
|
7535
7532
|
return layerOf(selectorOrElement) === layer;
|
7536
7533
|
};
|
7537
7534
|
|
7538
|
-
|
7535
|
+
/***
|
7539
7536
|
Destroys the given element or selector.
|
7540
7537
|
|
7541
7538
|
Takes care that all [`up.compiler()`](/up.compiler) destructors, if any, are called.
|
@@ -7608,7 +7605,7 @@ is built from these functions. You can use them to extend Unpoly from your
|
|
7608
7605
|
return options.log !== false && !$element.is('.up-placeholder, .up-tooltip, .up-modal, .up-popup');
|
7609
7606
|
};
|
7610
7607
|
|
7611
|
-
|
7608
|
+
/***
|
7612
7609
|
Before a page fragment is being [destroyed](/up.destroy), this
|
7613
7610
|
event is [emitted](/up.emit) on the fragment.
|
7614
7611
|
|
@@ -7621,7 +7618,7 @@ is built from these functions. You can use them to extend Unpoly from your
|
|
7621
7618
|
@stable
|
7622
7619
|
*/
|
7623
7620
|
|
7624
|
-
|
7621
|
+
/***
|
7625
7622
|
This event is [emitted](/up.emit) right before a [destroyed](/up.destroy)
|
7626
7623
|
page fragment is removed from the DOM.
|
7627
7624
|
|
@@ -7634,7 +7631,7 @@ is built from these functions. You can use them to extend Unpoly from your
|
|
7634
7631
|
@stable
|
7635
7632
|
*/
|
7636
7633
|
|
7637
|
-
|
7634
|
+
/***
|
7638
7635
|
Replaces the given element with a fresh copy fetched from the server.
|
7639
7636
|
|
7640
7637
|
\#\#\# Example
|
@@ -7671,7 +7668,6 @@ is built from these functions. You can use them to extend Unpoly from your
|
|
7671
7668
|
});
|
7672
7669
|
up.on('up:framework:reset', reset);
|
7673
7670
|
return {
|
7674
|
-
knife: eval(typeof Knife !== "undefined" && Knife !== null ? Knife.point : void 0),
|
7675
7671
|
replace: replace,
|
7676
7672
|
reload: reload,
|
7677
7673
|
destroy: destroy,
|
@@ -7700,7 +7696,7 @@ is built from these functions. You can use them to extend Unpoly from your
|
|
7700
7696
|
|
7701
7697
|
}).call(this);
|
7702
7698
|
|
7703
|
-
|
7699
|
+
/***
|
7704
7700
|
Animation
|
7705
7701
|
=========
|
7706
7702
|
|
@@ -7746,7 +7742,7 @@ You can define custom animations using [`up.transition()`](/up.transition) and
|
|
7746
7742
|
defaultNamedTransitions = {};
|
7747
7743
|
motionTracker = new up.MotionTracker('motion');
|
7748
7744
|
|
7749
|
-
|
7745
|
+
/***
|
7750
7746
|
Sets default options for animations and transitions.
|
7751
7747
|
|
7752
7748
|
@property up.motion.config
|
@@ -7782,7 +7778,7 @@ You can define custom animations using [`up.transition()`](/up.transition) and
|
|
7782
7778
|
return config.reset();
|
7783
7779
|
};
|
7784
7780
|
|
7785
|
-
|
7781
|
+
/***
|
7786
7782
|
Returns whether Unpoly will perform animations.
|
7787
7783
|
|
7788
7784
|
Set [`up.motion.config.enabled`](/up.motion.config) `false` in order to disable animations globally.
|
@@ -7795,7 +7791,7 @@ You can define custom animations using [`up.transition()`](/up.transition) and
|
|
7795
7791
|
return config.enabled;
|
7796
7792
|
};
|
7797
7793
|
|
7798
|
-
|
7794
|
+
/***
|
7799
7795
|
Applies the given animation to the given element.
|
7800
7796
|
|
7801
7797
|
\#\#\# Example
|
@@ -7896,7 +7892,7 @@ You can define custom animations using [`up.transition()`](/up.transition) and
|
|
7896
7892
|
return Promise.resolve();
|
7897
7893
|
};
|
7898
7894
|
|
7899
|
-
|
7895
|
+
/***
|
7900
7896
|
Animates the given element's CSS properties using CSS transitions.
|
7901
7897
|
|
7902
7898
|
If the element is already being animated, the previous animation
|
@@ -7973,7 +7969,7 @@ You can define custom animations using [`up.transition()`](/up.transition) and
|
|
7973
7969
|
return motionTracker.start($element, startCssTransition);
|
7974
7970
|
};
|
7975
7971
|
|
7976
|
-
|
7972
|
+
/***
|
7977
7973
|
Extracts animation-related options from the given options hash.
|
7978
7974
|
If `$element` is given, also inspects the element for animation-related
|
7979
7975
|
attributes like `up-easing` or `up-duration`.
|
@@ -7998,7 +7994,7 @@ You can define custom animations using [`up.transition()`](/up.transition) and
|
|
7998
7994
|
return namedAnimations[name] || up.fail("Unknown animation %o", name);
|
7999
7995
|
};
|
8000
7996
|
|
8001
|
-
|
7997
|
+
/***
|
8002
7998
|
@function withGhosts
|
8003
7999
|
@return {Promise}
|
8004
8000
|
@internal
|
@@ -8043,7 +8039,7 @@ You can define custom animations using [`up.transition()`](/up.transition) and
|
|
8043
8039
|
});
|
8044
8040
|
};
|
8045
8041
|
|
8046
|
-
|
8042
|
+
/***
|
8047
8043
|
Completes [animations](/up.animate) and [transitions](/up.morph).
|
8048
8044
|
|
8049
8045
|
If called without arguments, all animations on the screen are completed.
|
@@ -8064,7 +8060,7 @@ You can define custom animations using [`up.transition()`](/up.transition) and
|
|
8064
8060
|
return motionTracker.finish(elementOrSelector);
|
8065
8061
|
};
|
8066
8062
|
|
8067
|
-
|
8063
|
+
/***
|
8068
8064
|
Performs an animated transition between two elements.
|
8069
8065
|
Transitions are implement by performing two animations in parallel,
|
8070
8066
|
causing one element to disappear and the other to appear.
|
@@ -8180,7 +8176,7 @@ You can define custom animations using [`up.transition()`](/up.transition) and
|
|
8180
8176
|
}
|
8181
8177
|
};
|
8182
8178
|
|
8183
|
-
|
8179
|
+
/***
|
8184
8180
|
This instantly causes the side effects of a successful transition.
|
8185
8181
|
We use this to skip morphing for old browsers, or when the developer
|
8186
8182
|
decides to only animate the new element (i.e. no real ghosting or transition).
|
@@ -8197,7 +8193,7 @@ You can define custom animations using [`up.transition()`](/up.transition) and
|
|
8197
8193
|
return up.layout.revealOrRestoreScroll($new, scrollOptions);
|
8198
8194
|
};
|
8199
8195
|
|
8200
|
-
|
8196
|
+
/***
|
8201
8197
|
@internal
|
8202
8198
|
*/
|
8203
8199
|
prependCopy = function($element, $viewport) {
|
@@ -8247,7 +8243,7 @@ You can define custom animations using [`up.transition()`](/up.transition) and
|
|
8247
8243
|
};
|
8248
8244
|
};
|
8249
8245
|
|
8250
|
-
|
8246
|
+
/***
|
8251
8247
|
Defines a named transition.
|
8252
8248
|
|
8253
8249
|
Here is the definition of the pre-defined `cross-fade` animation:
|
@@ -8284,7 +8280,7 @@ You can define custom animations using [`up.transition()`](/up.transition) and
|
|
8284
8280
|
return namedTransitions[name] = transition;
|
8285
8281
|
};
|
8286
8282
|
|
8287
|
-
|
8283
|
+
/***
|
8288
8284
|
Defines a named animation.
|
8289
8285
|
|
8290
8286
|
Here is the definition of the pre-defined `fade-in` animation:
|
@@ -8324,7 +8320,7 @@ You can define custom animations using [`up.transition()`](/up.transition) and
|
|
8324
8320
|
return defaultNamedTransitions = u.copy(namedTransitions);
|
8325
8321
|
};
|
8326
8322
|
|
8327
|
-
|
8323
|
+
/***
|
8328
8324
|
Returns whether the given animation option will cause the animation
|
8329
8325
|
to be skipped.
|
8330
8326
|
|
@@ -8460,7 +8456,7 @@ You can define custom animations using [`up.transition()`](/up.transition) and
|
|
8460
8456
|
|
8461
8457
|
}).call(this);
|
8462
8458
|
|
8463
|
-
|
8459
|
+
/***
|
8464
8460
|
AJAX acceleration
|
8465
8461
|
=================
|
8466
8462
|
|
@@ -8516,7 +8512,7 @@ Other Unpoly modules contain even more tricks to outsmart network latency:
|
|
8516
8512
|
slowEventEmitted = void 0;
|
8517
8513
|
queuedLoaders = [];
|
8518
8514
|
|
8519
|
-
|
8515
|
+
/***
|
8520
8516
|
@property up.proxy.config
|
8521
8517
|
@param {number} [config.preloadDelay=75]
|
8522
8518
|
The number of milliseconds to wait before [`[up-preload]`](/a-up-preload)
|
@@ -8573,7 +8569,7 @@ Other Unpoly modules contain even more tricks to outsmart network latency:
|
|
8573
8569
|
}
|
8574
8570
|
});
|
8575
8571
|
|
8576
|
-
|
8572
|
+
/***
|
8577
8573
|
Returns a cached response for the given request.
|
8578
8574
|
|
8579
8575
|
Returns `undefined` if the given request is not currently cached.
|
@@ -8626,7 +8622,7 @@ Other Unpoly modules contain even more tricks to outsmart network latency:
|
|
8626
8622
|
};
|
8627
8623
|
reset();
|
8628
8624
|
|
8629
|
-
|
8625
|
+
/***
|
8630
8626
|
Makes an AJAX request to the given URL.
|
8631
8627
|
|
8632
8628
|
\#\#\# Example
|
@@ -8715,7 +8711,7 @@ Other Unpoly modules contain even more tricks to outsmart network latency:
|
|
8715
8711
|
return promise;
|
8716
8712
|
};
|
8717
8713
|
|
8718
|
-
|
8714
|
+
/***
|
8719
8715
|
Makes an AJAX request to the given URL and caches the response.
|
8720
8716
|
|
8721
8717
|
The function returns a promise that fulfills with the response text.
|
@@ -8775,7 +8771,7 @@ Other Unpoly modules contain even more tricks to outsmart network latency:
|
|
8775
8771
|
});
|
8776
8772
|
};
|
8777
8773
|
|
8778
|
-
|
8774
|
+
/***
|
8779
8775
|
Returns `true` if the proxy is not currently waiting
|
8780
8776
|
for a request to finish. Returns `false` otherwise.
|
8781
8777
|
|
@@ -8788,7 +8784,7 @@ Other Unpoly modules contain even more tricks to outsmart network latency:
|
|
8788
8784
|
return pendingCount === 0;
|
8789
8785
|
};
|
8790
8786
|
|
8791
|
-
|
8787
|
+
/***
|
8792
8788
|
Returns `true` if the proxy is currently waiting
|
8793
8789
|
for a request to finish. Returns `false` otherwise.
|
8794
8790
|
|
@@ -8816,7 +8812,7 @@ Other Unpoly modules contain even more tricks to outsmart network latency:
|
|
8816
8812
|
}
|
8817
8813
|
};
|
8818
8814
|
|
8819
|
-
|
8815
|
+
/***
|
8820
8816
|
This event is [emitted](/up.emit) when [AJAX requests](/up.request)
|
8821
8817
|
are taking long to finish.
|
8822
8818
|
|
@@ -8880,7 +8876,7 @@ Other Unpoly modules contain even more tricks to outsmart network latency:
|
|
8880
8876
|
}
|
8881
8877
|
};
|
8882
8878
|
|
8883
|
-
|
8879
|
+
/***
|
8884
8880
|
This event is [emitted](/up.emit) when [AJAX requests](/up.request)
|
8885
8881
|
have [taken long to finish](/up:proxy:slow), but have finished now.
|
8886
8882
|
|
@@ -8925,7 +8921,7 @@ Other Unpoly modules contain even more tricks to outsmart network latency:
|
|
8925
8921
|
}
|
8926
8922
|
};
|
8927
8923
|
|
8928
|
-
|
8924
|
+
/***
|
8929
8925
|
This event is [emitted](/up.emit) before an [AJAX request](/up.request)
|
8930
8926
|
is sent over the network.
|
8931
8927
|
|
@@ -8965,7 +8961,7 @@ Other Unpoly modules contain even more tricks to outsmart network latency:
|
|
8965
8961
|
}
|
8966
8962
|
};
|
8967
8963
|
|
8968
|
-
|
8964
|
+
/***
|
8969
8965
|
This event is [emitted](/up.emit) when the response to an
|
8970
8966
|
[AJAX request](/up.request) has been received.
|
8971
8967
|
|
@@ -8980,7 +8976,7 @@ Other Unpoly modules contain even more tricks to outsmart network latency:
|
|
8980
8976
|
@experimental
|
8981
8977
|
*/
|
8982
8978
|
|
8983
|
-
|
8979
|
+
/***
|
8984
8980
|
This event is [emitted](/up.emit) when an [AJAX request](/up.request)
|
8985
8981
|
encounters fatal error like a timeout or loss of network connectivity.
|
8986
8982
|
|
@@ -8998,7 +8994,7 @@ Other Unpoly modules contain even more tricks to outsmart network latency:
|
|
8998
8994
|
return void 0;
|
8999
8995
|
};
|
9000
8996
|
|
9001
|
-
|
8997
|
+
/***
|
9002
8998
|
Makes the proxy assume that `newRequest` has the same response as the
|
9003
8999
|
already cached `oldRequest`.
|
9004
9000
|
|
@@ -9012,7 +9008,7 @@ Other Unpoly modules contain even more tricks to outsmart network latency:
|
|
9012
9008
|
*/
|
9013
9009
|
alias = cache.alias;
|
9014
9010
|
|
9015
|
-
|
9011
|
+
/***
|
9016
9012
|
Manually stores a promise for the response to the given request.
|
9017
9013
|
|
9018
9014
|
@function up.proxy.set
|
@@ -9025,7 +9021,7 @@ Other Unpoly modules contain even more tricks to outsmart network latency:
|
|
9025
9021
|
*/
|
9026
9022
|
set = cache.set;
|
9027
9023
|
|
9028
|
-
|
9024
|
+
/***
|
9029
9025
|
Manually removes the given request from the cache.
|
9030
9026
|
|
9031
9027
|
You can also [configure](/up.proxy.config) when the proxy
|
@@ -9039,7 +9035,7 @@ Other Unpoly modules contain even more tricks to outsmart network latency:
|
|
9039
9035
|
*/
|
9040
9036
|
remove = cache.remove;
|
9041
9037
|
|
9042
|
-
|
9038
|
+
/***
|
9043
9039
|
Removes all cache entries.
|
9044
9040
|
|
9045
9041
|
Unpoly also automatically clears the cache whenever it processes
|
@@ -9074,7 +9070,7 @@ Other Unpoly modules contain even more tricks to outsmart network latency:
|
|
9074
9070
|
}
|
9075
9071
|
};
|
9076
9072
|
|
9077
|
-
|
9073
|
+
/***
|
9078
9074
|
Preloads the given link.
|
9079
9075
|
|
9080
9076
|
When the link is clicked later, the response will already be cached,
|
@@ -9101,14 +9097,14 @@ Other Unpoly modules contain even more tricks to outsmart network latency:
|
|
9101
9097
|
}
|
9102
9098
|
};
|
9103
9099
|
|
9104
|
-
|
9100
|
+
/***
|
9105
9101
|
@internal
|
9106
9102
|
*/
|
9107
9103
|
isSafeMethod = function(method) {
|
9108
9104
|
return u.contains(config.safeMethods, method);
|
9109
9105
|
};
|
9110
9106
|
|
9111
|
-
|
9107
|
+
/***
|
9112
9108
|
@internal
|
9113
9109
|
*/
|
9114
9110
|
wrapMethod = function(method, data, appendOpts) {
|
@@ -9119,7 +9115,7 @@ Other Unpoly modules contain even more tricks to outsmart network latency:
|
|
9119
9115
|
return [method, data];
|
9120
9116
|
};
|
9121
9117
|
|
9122
|
-
|
9118
|
+
/***
|
9123
9119
|
Links with an `up-preload` attribute will silently fetch their target
|
9124
9120
|
when the user hovers over the click area, or when the user puts her
|
9125
9121
|
mouse/finger down (before releasing).
|
@@ -9169,7 +9165,7 @@ Other Unpoly modules contain even more tricks to outsmart network latency:
|
|
9169
9165
|
|
9170
9166
|
}).call(this);
|
9171
9167
|
|
9172
|
-
|
9168
|
+
/***
|
9173
9169
|
Linking to fragments
|
9174
9170
|
====================
|
9175
9171
|
|
@@ -9243,7 +9239,7 @@ new page is loading.
|
|
9243
9239
|
var DEFAULT_FOLLOW_VARIANT, addFollowVariant, allowDefault, defaultFollow, defaultPreload, follow, followMethod, followVariantForLink, followVariants, isFollowable, isSafe, makeFollowable, shouldProcessEvent, u, visit;
|
9244
9240
|
u = up.util;
|
9245
9241
|
|
9246
|
-
|
9242
|
+
/***
|
9247
9243
|
Visits the given URL without a full page load.
|
9248
9244
|
This is done by fetching `url` through an AJAX request
|
9249
9245
|
and [replacing](/up.replace) the current `<body>` element with the response's `<body>` element.
|
@@ -9268,7 +9264,7 @@ new page is loading.
|
|
9268
9264
|
return up.replace(selector, url, options);
|
9269
9265
|
};
|
9270
9266
|
|
9271
|
-
|
9267
|
+
/***
|
9272
9268
|
Follows the given link via AJAX and [replaces](/up.replace) the current page
|
9273
9269
|
with HTML from the response.
|
9274
9270
|
|
@@ -9318,7 +9314,7 @@ new page is loading.
|
|
9318
9314
|
return variant.followLink($link, options);
|
9319
9315
|
};
|
9320
9316
|
|
9321
|
-
|
9317
|
+
/***
|
9322
9318
|
This event is [emitted](/up.emit) when a link is [followed](/up.follow) through Unpoly.
|
9323
9319
|
|
9324
9320
|
@event up:link:follow
|
@@ -9329,7 +9325,7 @@ new page is loading.
|
|
9329
9325
|
@stable
|
9330
9326
|
*/
|
9331
9327
|
|
9332
|
-
|
9328
|
+
/***
|
9333
9329
|
@function defaultFollow
|
9334
9330
|
@internal
|
9335
9331
|
*/
|
@@ -9364,7 +9360,7 @@ new page is loading.
|
|
9364
9360
|
return defaultFollow($link, options);
|
9365
9361
|
};
|
9366
9362
|
|
9367
|
-
|
9363
|
+
/***
|
9368
9364
|
Returns the HTTP method that should be used when following the given link.
|
9369
9365
|
|
9370
9366
|
Looks at the link's `up-method` or `data-method` attribute.
|
@@ -9382,7 +9378,7 @@ new page is loading.
|
|
9382
9378
|
return u.option(options.method, $link.attr('up-method'), $link.attr('data-method'), 'get').toUpperCase();
|
9383
9379
|
};
|
9384
9380
|
|
9385
|
-
|
9381
|
+
/***
|
9386
9382
|
No-op that is called when we allow a browser's default action to go through,
|
9387
9383
|
so we can spy on it in unit tests. See `link_spec.js`.
|
9388
9384
|
|
@@ -9392,7 +9388,7 @@ new page is loading.
|
|
9392
9388
|
allowDefault = function(event) {};
|
9393
9389
|
followVariants = [];
|
9394
9390
|
|
9395
|
-
|
9391
|
+
/***
|
9396
9392
|
Registers the given handler for links with the given selector.
|
9397
9393
|
|
9398
9394
|
This does more than a simple `click` handler:
|
@@ -9415,7 +9411,7 @@ new page is loading.
|
|
9415
9411
|
return variant;
|
9416
9412
|
};
|
9417
9413
|
|
9418
|
-
|
9414
|
+
/***
|
9419
9415
|
Returns whether the given link will be handled by Unpoly instead of making a full page load.
|
9420
9416
|
|
9421
9417
|
A link will be handled by Unpoly if it has an attribute
|
@@ -9432,7 +9428,7 @@ new page is loading.
|
|
9432
9428
|
});
|
9433
9429
|
};
|
9434
9430
|
|
9435
|
-
|
9431
|
+
/***
|
9436
9432
|
Returns the handler function that can be used to follow the given link.
|
9437
9433
|
E.g. it wil return a handler calling `up.modal.follow` if the link is a `[up-modal]`,
|
9438
9434
|
but a handler calling `up.link.follow` if the links is `[up-target]`.
|
@@ -9454,7 +9450,7 @@ new page is loading.
|
|
9454
9450
|
return variant;
|
9455
9451
|
};
|
9456
9452
|
|
9457
|
-
|
9453
|
+
/***
|
9458
9454
|
Makes sure that the given link will be handled by Unpoly instead of making a full page load.
|
9459
9455
|
|
9460
9456
|
This is done by giving the link an `up-follow` attribute
|
@@ -9480,7 +9476,7 @@ new page is loading.
|
|
9480
9476
|
return $targetedChildLink.length === 0 && $targetedInput.length === 0 && u.isUnmodifiedMouseEvent(event);
|
9481
9477
|
};
|
9482
9478
|
|
9483
|
-
|
9479
|
+
/***
|
9484
9480
|
Returns whether the given link has a [safe](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.1.1)
|
9485
9481
|
HTTP method like `GET`.
|
9486
9482
|
|
@@ -9494,7 +9490,7 @@ new page is loading.
|
|
9494
9490
|
return up.proxy.isSafeMethod(method);
|
9495
9491
|
};
|
9496
9492
|
|
9497
|
-
|
9493
|
+
/***
|
9498
9494
|
Follows this link via AJAX and replaces a CSS selector in the current page
|
9499
9495
|
with corresponding elements from a new page fetched from the server:
|
9500
9496
|
|
@@ -9608,7 +9604,7 @@ new page is loading.
|
|
9608
9604
|
}
|
9609
9605
|
});
|
9610
9606
|
|
9611
|
-
|
9607
|
+
/***
|
9612
9608
|
If applied on a link, follows this link via AJAX and replaces the
|
9613
9609
|
current `<body>` element with the response's `<body>` element.
|
9614
9610
|
|
@@ -9659,7 +9655,7 @@ new page is loading.
|
|
9659
9655
|
@stable
|
9660
9656
|
*/
|
9661
9657
|
|
9662
|
-
|
9658
|
+
/***
|
9663
9659
|
By adding an `up-instant` attribute to a link, the destination will be
|
9664
9660
|
fetched on `mousedown` instead of `click` (`mouseup`).
|
9665
9661
|
|
@@ -9681,7 +9677,7 @@ new page is loading.
|
|
9681
9677
|
@stable
|
9682
9678
|
*/
|
9683
9679
|
|
9684
|
-
|
9680
|
+
/***
|
9685
9681
|
Marks up the current link to be followed *as fast as possible*.
|
9686
9682
|
|
9687
9683
|
This is done by:
|
@@ -9717,7 +9713,7 @@ new page is loading.
|
|
9717
9713
|
return u.setMissingAttrs($element, newAttrs);
|
9718
9714
|
});
|
9719
9715
|
|
9720
|
-
|
9716
|
+
/***
|
9721
9717
|
Add an `[up-expand]` attribute to any element that contains a link
|
9722
9718
|
in order to enlarge the link's click area.
|
9723
9719
|
|
@@ -9788,7 +9784,6 @@ new page is loading.
|
|
9788
9784
|
}
|
9789
9785
|
});
|
9790
9786
|
return {
|
9791
|
-
knife: eval(typeof Knife !== "undefined" && Knife !== null ? Knife.point : void 0),
|
9792
9787
|
visit: visit,
|
9793
9788
|
follow: follow,
|
9794
9789
|
makeFollowable: makeFollowable,
|
@@ -9808,7 +9803,7 @@ new page is loading.
|
|
9808
9803
|
|
9809
9804
|
}).call(this);
|
9810
9805
|
|
9811
|
-
|
9806
|
+
/***
|
9812
9807
|
Forms
|
9813
9808
|
=====
|
9814
9809
|
|
@@ -9826,7 +9821,7 @@ open dialogs with sub-forms, etc. all without losing form state.
|
|
9826
9821
|
var autosubmit, config, fieldSelector, findSwitcherForTarget, observe, observeField, reset, resolveValidateTarget, submit, switchTarget, switchTargets, switcherValues, u, validate;
|
9827
9822
|
u = up.util;
|
9828
9823
|
|
9829
|
-
|
9824
|
+
/***
|
9830
9825
|
Sets default options for form submission and validation.
|
9831
9826
|
|
9832
9827
|
@property up.form.config
|
@@ -9855,7 +9850,7 @@ open dialogs with sub-forms, etc. all without losing form state.
|
|
9855
9850
|
return config.reset();
|
9856
9851
|
};
|
9857
9852
|
|
9858
|
-
|
9853
|
+
/***
|
9859
9854
|
@function up.form.fieldSelector
|
9860
9855
|
@internal
|
9861
9856
|
*/
|
@@ -9863,7 +9858,7 @@ open dialogs with sub-forms, etc. all without losing form state.
|
|
9863
9858
|
return u.multiSelector(config.fields);
|
9864
9859
|
};
|
9865
9860
|
|
9866
|
-
|
9861
|
+
/***
|
9867
9862
|
Submits a form via AJAX and updates a page fragment with the response.
|
9868
9863
|
|
9869
9864
|
up.submit('form.new-user', { target: '.main' })
|
@@ -9999,7 +9994,7 @@ open dialogs with sub-forms, etc. all without losing form state.
|
|
9999
9994
|
});
|
10000
9995
|
};
|
10001
9996
|
|
10002
|
-
|
9997
|
+
/***
|
10003
9998
|
This event is [emitted](/up.emit) when a form is [submitted](/up.submit) through Unpoly.
|
10004
9999
|
|
10005
10000
|
@event up:form:submit
|
@@ -10010,7 +10005,7 @@ open dialogs with sub-forms, etc. all without losing form state.
|
|
10010
10005
|
@stable
|
10011
10006
|
*/
|
10012
10007
|
|
10013
|
-
|
10008
|
+
/***
|
10014
10009
|
Observes form fields and runs a callback when a value changes.
|
10015
10010
|
|
10016
10011
|
This is useful for observing text fields while the user is typing.
|
@@ -10096,9 +10091,7 @@ open dialogs with sub-forms, etc. all without losing form state.
|
|
10096
10091
|
callback = null;
|
10097
10092
|
rawCallback = u.option(callbackArg, u.presentAttr($element, 'up-observe'));
|
10098
10093
|
if (u.isString(rawCallback)) {
|
10099
|
-
callback =
|
10100
|
-
return eval(rawCallback);
|
10101
|
-
};
|
10094
|
+
callback = new Function('value', '$field', rawCallback);
|
10102
10095
|
} else {
|
10103
10096
|
callback = rawCallback || up.fail('up.observe: No change callback given');
|
10104
10097
|
}
|
@@ -10120,7 +10113,7 @@ open dialogs with sub-forms, etc. all without losing form state.
|
|
10120
10113
|
return observer.stop;
|
10121
10114
|
};
|
10122
10115
|
|
10123
|
-
|
10116
|
+
/***
|
10124
10117
|
[Observes](/up.observe) a field or form and submits the form when a value changes.
|
10125
10118
|
|
10126
10119
|
Both the form and the changed field will be assigned a CSS class [`form-up-active`](/form-up-active)
|
@@ -10165,7 +10158,7 @@ open dialogs with sub-forms, etc. all without losing form state.
|
|
10165
10158
|
return target;
|
10166
10159
|
};
|
10167
10160
|
|
10168
|
-
|
10161
|
+
/***
|
10169
10162
|
Performs a server-side validation of a form field.
|
10170
10163
|
|
10171
10164
|
`up.validate()` submits the given field's form with an additional `X-Up-Validate`
|
@@ -10238,7 +10231,7 @@ open dialogs with sub-forms, etc. all without losing form state.
|
|
10238
10231
|
return values;
|
10239
10232
|
};
|
10240
10233
|
|
10241
|
-
|
10234
|
+
/***
|
10242
10235
|
Shows or hides a target selector depending on the value.
|
10243
10236
|
|
10244
10237
|
See [`input[up-switch]`](/input-up-switch) for more documentation and examples.
|
@@ -10266,7 +10259,7 @@ open dialogs with sub-forms, etc. all without losing form state.
|
|
10266
10259
|
});
|
10267
10260
|
};
|
10268
10261
|
|
10269
|
-
|
10262
|
+
/***
|
10270
10263
|
@internal
|
10271
10264
|
*/
|
10272
10265
|
switchTarget = function(target, fieldValues) {
|
@@ -10288,7 +10281,7 @@ open dialogs with sub-forms, etc. all without losing form state.
|
|
10288
10281
|
return $target.addClass('up-switched');
|
10289
10282
|
};
|
10290
10283
|
|
10291
|
-
|
10284
|
+
/***
|
10292
10285
|
@internal
|
10293
10286
|
*/
|
10294
10287
|
findSwitcherForTarget = function($target) {
|
@@ -10306,7 +10299,7 @@ open dialogs with sub-forms, etc. all without losing form state.
|
|
10306
10299
|
}
|
10307
10300
|
};
|
10308
10301
|
|
10309
|
-
|
10302
|
+
/***
|
10310
10303
|
Forms with an `up-target` attribute are [submitted via AJAX](/up.submit)
|
10311
10304
|
instead of triggering a full page reload.
|
10312
10305
|
|
@@ -10444,7 +10437,7 @@ open dialogs with sub-forms, etc. all without losing form state.
|
|
10444
10437
|
return u.muteRejection(submit($form));
|
10445
10438
|
});
|
10446
10439
|
|
10447
|
-
|
10440
|
+
/***
|
10448
10441
|
When a form field with this attribute is changed, the form is validated on the server
|
10449
10442
|
and is updated with validation messages.
|
10450
10443
|
|
@@ -10593,7 +10586,7 @@ open dialogs with sub-forms, etc. all without losing form state.
|
|
10593
10586
|
return u.muteRejection(validate($field));
|
10594
10587
|
});
|
10595
10588
|
|
10596
|
-
|
10589
|
+
/***
|
10597
10590
|
Show or hide elements when a `<select>` or `<input>` has a given value.
|
10598
10591
|
|
10599
10592
|
\#\#\# Example: Select options
|
@@ -10677,7 +10670,7 @@ open dialogs with sub-forms, etc. all without losing form state.
|
|
10677
10670
|
return switchTarget($element);
|
10678
10671
|
});
|
10679
10672
|
|
10680
|
-
|
10673
|
+
/***
|
10681
10674
|
Observes this field and runs a callback when a value changes.
|
10682
10675
|
|
10683
10676
|
This is useful for observing text fields while the user is typing.
|
@@ -10712,7 +10705,7 @@ open dialogs with sub-forms, etc. all without losing form state.
|
|
10712
10705
|
@stable
|
10713
10706
|
*/
|
10714
10707
|
|
10715
|
-
|
10708
|
+
/***
|
10716
10709
|
Observes this form and runs a callback when any field changes.
|
10717
10710
|
|
10718
10711
|
This is useful for observing text fields while the user is typing.
|
@@ -10751,7 +10744,7 @@ open dialogs with sub-forms, etc. all without losing form state.
|
|
10751
10744
|
return observe($formOrField);
|
10752
10745
|
});
|
10753
10746
|
|
10754
|
-
|
10747
|
+
/***
|
10755
10748
|
[Observes](/up.observe) this form field and submits the form when its value changes.
|
10756
10749
|
|
10757
10750
|
Both the form and the changed field will be assigned a CSS class [`up-active`](/form-up-active)
|
@@ -10774,7 +10767,7 @@ open dialogs with sub-forms, etc. all without losing form state.
|
|
10774
10767
|
@stable
|
10775
10768
|
*/
|
10776
10769
|
|
10777
|
-
|
10770
|
+
/***
|
10778
10771
|
[Observes](/up.observe) this form and submits the form when *any* field changes.
|
10779
10772
|
|
10780
10773
|
Both the form and the field will be assigned a CSS class [`up-active`](/form-up-active)
|
@@ -10801,7 +10794,6 @@ open dialogs with sub-forms, etc. all without losing form state.
|
|
10801
10794
|
});
|
10802
10795
|
up.on('up:framework:reset', reset);
|
10803
10796
|
return {
|
10804
|
-
knife: eval(typeof Knife !== "undefined" && Knife !== null ? Knife.point : void 0),
|
10805
10797
|
config: config,
|
10806
10798
|
submit: submit,
|
10807
10799
|
observe: observe,
|
@@ -10822,7 +10814,7 @@ open dialogs with sub-forms, etc. all without losing form state.
|
|
10822
10814
|
|
10823
10815
|
}).call(this);
|
10824
10816
|
|
10825
|
-
|
10817
|
+
/***
|
10826
10818
|
Pop-up overlays
|
10827
10819
|
===============
|
10828
10820
|
|
@@ -10875,7 +10867,7 @@ The HTML of a popup element is simply this:
|
|
10875
10867
|
var align, attachAsap, attachNow, autoclose, chain, closeAsap, closeNow, config, contains, createHiddenFrame, discardHistory, isOpen, preloadNow, reset, state, toggleAsap, u, unveilFrame;
|
10876
10868
|
u = up.util;
|
10877
10869
|
|
10878
|
-
|
10870
|
+
/***
|
10879
10871
|
Sets default options for future popups.
|
10880
10872
|
|
10881
10873
|
@property up.popup.config
|
@@ -10913,7 +10905,7 @@ The HTML of a popup element is simply this:
|
|
10913
10905
|
history: false
|
10914
10906
|
});
|
10915
10907
|
|
10916
|
-
|
10908
|
+
/***
|
10917
10909
|
Returns the URL from which the current popup's contents were loaded.
|
10918
10910
|
|
10919
10911
|
Returns `undefined` if no popup is open.
|
@@ -10924,7 +10916,7 @@ The HTML of a popup element is simply this:
|
|
10924
10916
|
@stable
|
10925
10917
|
*/
|
10926
10918
|
|
10927
|
-
|
10919
|
+
/***
|
10928
10920
|
Returns the URL of the page or modal behind the popup.
|
10929
10921
|
|
10930
10922
|
@function up.popup.coveredUrl
|
@@ -11000,7 +10992,7 @@ The HTML of a popup element is simply this:
|
|
11000
10992
|
return state.$popup.show();
|
11001
10993
|
};
|
11002
10994
|
|
11003
|
-
|
10995
|
+
/***
|
11004
10996
|
Returns whether popup modal is currently open.
|
11005
10997
|
|
11006
10998
|
@function up.popup.isOpen
|
@@ -11011,7 +11003,7 @@ The HTML of a popup element is simply this:
|
|
11011
11003
|
return state.phase === 'opened' || state.phase === 'opening';
|
11012
11004
|
};
|
11013
11005
|
|
11014
|
-
|
11006
|
+
/***
|
11015
11007
|
Attaches a popup overlay to the given element or selector.
|
11016
11008
|
|
11017
11009
|
Emits events [`up:popup:open`](/up:popup:open) and [`up:popup:opened`](/up:popup:opened).
|
@@ -11126,7 +11118,7 @@ The HTML of a popup element is simply this:
|
|
11126
11118
|
});
|
11127
11119
|
};
|
11128
11120
|
|
11129
|
-
|
11121
|
+
/***
|
11130
11122
|
This event is [emitted](/up.emit) when a popup is starting to open.
|
11131
11123
|
|
11132
11124
|
@event up:popup:open
|
@@ -11135,14 +11127,14 @@ The HTML of a popup element is simply this:
|
|
11135
11127
|
@stable
|
11136
11128
|
*/
|
11137
11129
|
|
11138
|
-
|
11130
|
+
/***
|
11139
11131
|
This event is [emitted](/up.emit) when a popup has finished opening.
|
11140
11132
|
|
11141
11133
|
@event up:popup:opened
|
11142
11134
|
@stable
|
11143
11135
|
*/
|
11144
11136
|
|
11145
|
-
|
11137
|
+
/***
|
11146
11138
|
Closes a currently opened popup overlay.
|
11147
11139
|
|
11148
11140
|
Does nothing if no popup is currently open.
|
@@ -11209,7 +11201,7 @@ The HTML of a popup element is simply this:
|
|
11209
11201
|
}
|
11210
11202
|
};
|
11211
11203
|
|
11212
|
-
|
11204
|
+
/***
|
11213
11205
|
This event is [emitted](/up.emit) when a popup dialog
|
11214
11206
|
is starting to [close](/up.popup.close).
|
11215
11207
|
|
@@ -11219,7 +11211,7 @@ The HTML of a popup element is simply this:
|
|
11219
11211
|
@stable
|
11220
11212
|
*/
|
11221
11213
|
|
11222
|
-
|
11214
|
+
/***
|
11223
11215
|
This event is [emitted](/up.emit) when a popup dialog
|
11224
11216
|
is done [closing](/up.popup.close).
|
11225
11217
|
|
@@ -11233,7 +11225,7 @@ The HTML of a popup element is simply this:
|
|
11233
11225
|
}
|
11234
11226
|
};
|
11235
11227
|
|
11236
|
-
|
11228
|
+
/***
|
11237
11229
|
Returns whether the given element or selector is contained
|
11238
11230
|
within the current popup.
|
11239
11231
|
|
@@ -11249,7 +11241,7 @@ The HTML of a popup element is simply this:
|
|
11249
11241
|
return $element.closest('.up-popup').length > 0;
|
11250
11242
|
};
|
11251
11243
|
|
11252
|
-
|
11244
|
+
/***
|
11253
11245
|
Opens this link's destination of in a popup overlay:
|
11254
11246
|
|
11255
11247
|
<a href="/decks" up-popup=".deck_list">Switch deck</a>
|
@@ -11311,7 +11303,7 @@ The HTML of a popup element is simply this:
|
|
11311
11303
|
});
|
11312
11304
|
up.bus.onEscape(closeAsap);
|
11313
11305
|
|
11314
|
-
|
11306
|
+
/***
|
11315
11307
|
When this element is clicked, a currently open [popup](/up.popup) is closed.
|
11316
11308
|
|
11317
11309
|
Does nothing if no popup is currently open.
|
@@ -11340,7 +11332,6 @@ The HTML of a popup element is simply this:
|
|
11340
11332
|
up.on('up:history:restore', closeAsap);
|
11341
11333
|
up.on('up:framework:reset', reset);
|
11342
11334
|
return {
|
11343
|
-
knife: eval(typeof Knife !== "undefined" && Knife !== null ? Knife.point : void 0),
|
11344
11335
|
attach: attachAsap,
|
11345
11336
|
close: closeAsap,
|
11346
11337
|
url: function() {
|
@@ -11357,7 +11348,7 @@ The HTML of a popup element is simply this:
|
|
11357
11348
|
|
11358
11349
|
}).call(this);
|
11359
11350
|
|
11360
|
-
|
11351
|
+
/***
|
11361
11352
|
Modal dialogs
|
11362
11353
|
=============
|
11363
11354
|
|
@@ -11421,7 +11412,7 @@ or function.
|
|
11421
11412
|
var animate, autoclose, chain, closeAsap, closeNow, config, contains, createHiddenFrame, discardHistory, extractAsap, flavor, flavorDefault, flavorOverrides, flavors, followAsap, isOpen, markAsAnimating, openAsap, openNow, preloadNow, reset, shiftElements, state, templateHtml, u, unshiftElements, unveilFrame, visitAsap;
|
11422
11413
|
u = up.util;
|
11423
11414
|
|
11424
|
-
|
11415
|
+
/***
|
11425
11416
|
Sets default options for future modals.
|
11426
11417
|
|
11427
11418
|
@property up.modal.config
|
@@ -11504,7 +11495,7 @@ or function.
|
|
11504
11495
|
}
|
11505
11496
|
});
|
11506
11497
|
|
11507
|
-
|
11498
|
+
/***
|
11508
11499
|
Define modal variants with their own default configuration, CSS or HTML template.
|
11509
11500
|
|
11510
11501
|
\#\#\# Example
|
@@ -11546,7 +11537,7 @@ or function.
|
|
11546
11537
|
"default": {}
|
11547
11538
|
});
|
11548
11539
|
|
11549
|
-
|
11540
|
+
/***
|
11550
11541
|
Returns the source URL for the fragment displayed in the current modal overlay,
|
11551
11542
|
or `undefined` if no modal is currently open.
|
11552
11543
|
|
@@ -11556,7 +11547,7 @@ or function.
|
|
11556
11547
|
@stable
|
11557
11548
|
*/
|
11558
11549
|
|
11559
|
-
|
11550
|
+
/***
|
11560
11551
|
Returns the URL of the page behind the modal overlay.
|
11561
11552
|
|
11562
11553
|
@function up.modal.coveredUrl
|
@@ -11663,7 +11654,7 @@ or function.
|
|
11663
11654
|
return results;
|
11664
11655
|
};
|
11665
11656
|
|
11666
|
-
|
11657
|
+
/***
|
11667
11658
|
Returns whether a modal is currently open.
|
11668
11659
|
|
11669
11660
|
This also returns `true` if the modal is in an opening or closing animation.
|
@@ -11676,7 +11667,7 @@ or function.
|
|
11676
11667
|
return state.phase === 'opened' || state.phase === 'opening';
|
11677
11668
|
};
|
11678
11669
|
|
11679
|
-
|
11670
|
+
/***
|
11680
11671
|
Opens the given link's destination in a modal overlay:
|
11681
11672
|
|
11682
11673
|
var $link = $('...');
|
@@ -11738,7 +11729,7 @@ or function.
|
|
11738
11729
|
return openNow(options);
|
11739
11730
|
};
|
11740
11731
|
|
11741
|
-
|
11732
|
+
/***
|
11742
11733
|
Opens a modal for the given URL.
|
11743
11734
|
|
11744
11735
|
\#\#\# Example
|
@@ -11769,7 +11760,7 @@ or function.
|
|
11769
11760
|
return openAsap(options);
|
11770
11761
|
};
|
11771
11762
|
|
11772
|
-
|
11763
|
+
/***
|
11773
11764
|
[Extracts](/up.extract) the given CSS selector from the given HTML string and
|
11774
11765
|
opens the results in a modal.
|
11775
11766
|
|
@@ -11891,7 +11882,7 @@ or function.
|
|
11891
11882
|
});
|
11892
11883
|
};
|
11893
11884
|
|
11894
|
-
|
11885
|
+
/***
|
11895
11886
|
This event is [emitted](/up.emit) when a modal dialog is starting to open.
|
11896
11887
|
|
11897
11888
|
@event up:modal:open
|
@@ -11900,14 +11891,14 @@ or function.
|
|
11900
11891
|
@stable
|
11901
11892
|
*/
|
11902
11893
|
|
11903
|
-
|
11894
|
+
/***
|
11904
11895
|
This event is [emitted](/up.emit) when a modal dialog has finished opening.
|
11905
11896
|
|
11906
11897
|
@event up:modal:opened
|
11907
11898
|
@stable
|
11908
11899
|
*/
|
11909
11900
|
|
11910
|
-
|
11901
|
+
/***
|
11911
11902
|
Closes a currently opened modal overlay.
|
11912
11903
|
|
11913
11904
|
Does nothing if no modal is currently open.
|
@@ -11997,7 +11988,7 @@ or function.
|
|
11997
11988
|
}
|
11998
11989
|
};
|
11999
11990
|
|
12000
|
-
|
11991
|
+
/***
|
12001
11992
|
This event is [emitted](/up.emit) when a modal dialog
|
12002
11993
|
is starting to [close](/up.modal.close).
|
12003
11994
|
|
@@ -12007,7 +11998,7 @@ or function.
|
|
12007
11998
|
@stable
|
12008
11999
|
*/
|
12009
12000
|
|
12010
|
-
|
12001
|
+
/***
|
12011
12002
|
This event is [emitted](/up.emit) when a modal dialog
|
12012
12003
|
is done [closing](/up.modal.close).
|
12013
12004
|
|
@@ -12021,7 +12012,7 @@ or function.
|
|
12021
12012
|
}
|
12022
12013
|
};
|
12023
12014
|
|
12024
|
-
|
12015
|
+
/***
|
12025
12016
|
Returns whether the given element or selector is contained
|
12026
12017
|
within the current modal.
|
12027
12018
|
|
@@ -12044,7 +12035,7 @@ or function.
|
|
12044
12035
|
return u.assign(flavorOverrides(name), overrideConfig);
|
12045
12036
|
};
|
12046
12037
|
|
12047
|
-
|
12038
|
+
/***
|
12048
12039
|
Returns a config object for the given flavor.
|
12049
12040
|
Properties in that config should be preferred to the defaults in
|
12050
12041
|
[`/up.modal.config`](/up.modal.config).
|
@@ -12056,7 +12047,7 @@ or function.
|
|
12056
12047
|
return flavors[flavor] || (flavors[flavor] = {});
|
12057
12048
|
};
|
12058
12049
|
|
12059
|
-
|
12050
|
+
/***
|
12060
12051
|
Returns the config option for the current flavor.
|
12061
12052
|
|
12062
12053
|
@function flavorDefault
|
@@ -12076,7 +12067,7 @@ or function.
|
|
12076
12067
|
return value;
|
12077
12068
|
};
|
12078
12069
|
|
12079
|
-
|
12070
|
+
/***
|
12080
12071
|
Clicking this link will load the destination via AJAX and open
|
12081
12072
|
the given selector in a modal dialog.
|
12082
12073
|
|
@@ -12159,7 +12150,7 @@ or function.
|
|
12159
12150
|
}
|
12160
12151
|
});
|
12161
12152
|
|
12162
|
-
|
12153
|
+
/***
|
12163
12154
|
When this element is clicked, closes a currently open dialog.
|
12164
12155
|
|
12165
12156
|
Does nothing if no modal is currently open.
|
@@ -12177,7 +12168,7 @@ or function.
|
|
12177
12168
|
return up.bus.consumeAction(event);
|
12178
12169
|
});
|
12179
12170
|
|
12180
|
-
|
12171
|
+
/***
|
12181
12172
|
Clicking this link will load the destination via AJAX and open
|
12182
12173
|
the given selector in a modal drawer that slides in from the edge of the screen.
|
12183
12174
|
|
@@ -12212,7 +12203,7 @@ or function.
|
|
12212
12203
|
});
|
12213
12204
|
});
|
12214
12205
|
|
12215
|
-
|
12206
|
+
/***
|
12216
12207
|
Sets default options for future drawers.
|
12217
12208
|
|
12218
12209
|
@property up.modal.flavors.drawer
|
@@ -12250,7 +12241,6 @@ or function.
|
|
12250
12241
|
up.on('up:history:restore', closeAsap);
|
12251
12242
|
up.on('up:framework:reset', reset);
|
12252
12243
|
return {
|
12253
|
-
knife: eval(typeof Knife !== "undefined" && Knife !== null ? Knife.point : void 0),
|
12254
12244
|
visit: visitAsap,
|
12255
12245
|
follow: followAsap,
|
12256
12246
|
extract: extractAsap,
|
@@ -12271,7 +12261,7 @@ or function.
|
|
12271
12261
|
|
12272
12262
|
}).call(this);
|
12273
12263
|
|
12274
|
-
|
12264
|
+
/***
|
12275
12265
|
Tooltips
|
12276
12266
|
========
|
12277
12267
|
|
@@ -12308,7 +12298,7 @@ The tooltip element is appended to the end of `<body>`.
|
|
12308
12298
|
var align, attachAsap, attachNow, chain, closeAsap, closeNow, config, createElement, isOpen, reset, state, u;
|
12309
12299
|
u = up.util;
|
12310
12300
|
|
12311
|
-
|
12301
|
+
/***
|
12312
12302
|
Configures defaults for future tooltips.
|
12313
12303
|
|
12314
12304
|
@property up.tooltip.config
|
@@ -12399,7 +12389,7 @@ The tooltip element is appended to the end of `<body>`.
|
|
12399
12389
|
return state.$tooltip = $element;
|
12400
12390
|
};
|
12401
12391
|
|
12402
|
-
|
12392
|
+
/***
|
12403
12393
|
Opens a tooltip over the given element.
|
12404
12394
|
|
12405
12395
|
The unobtrusive variant of this is the [`[up-tooltip]`](/up-tooltip) selector.
|
@@ -12466,7 +12456,7 @@ The tooltip element is appended to the end of `<body>`.
|
|
12466
12456
|
});
|
12467
12457
|
};
|
12468
12458
|
|
12469
|
-
|
12459
|
+
/***
|
12470
12460
|
Closes a currently shown tooltip.
|
12471
12461
|
|
12472
12462
|
Does nothing if no tooltip is currently shown.
|
@@ -12504,7 +12494,7 @@ The tooltip element is appended to the end of `<body>`.
|
|
12504
12494
|
});
|
12505
12495
|
};
|
12506
12496
|
|
12507
|
-
|
12497
|
+
/***
|
12508
12498
|
Returns whether a tooltip is currently showing.
|
12509
12499
|
|
12510
12500
|
@function up.tooltip.isOpen
|
@@ -12514,7 +12504,7 @@ The tooltip element is appended to the end of `<body>`.
|
|
12514
12504
|
return state.phase === 'opening' || state.phase === 'opened';
|
12515
12505
|
};
|
12516
12506
|
|
12517
|
-
|
12507
|
+
/***
|
12518
12508
|
Displays a tooltip with text content when hovering the mouse over this element.
|
12519
12509
|
|
12520
12510
|
\#\#\# Example
|
@@ -12537,7 +12527,7 @@ The tooltip element is appended to the end of `<body>`.
|
|
12537
12527
|
@stable
|
12538
12528
|
*/
|
12539
12529
|
|
12540
|
-
|
12530
|
+
/***
|
12541
12531
|
Displays a tooltip with HTML content when hovering the mouse over this element:
|
12542
12532
|
|
12543
12533
|
<a href="/decks" up-tooltip-html="Show <b>all</b> decks">Decks</a>
|
@@ -12570,7 +12560,7 @@ The tooltip element is appended to the end of `<body>`.
|
|
12570
12560
|
|
12571
12561
|
}).call(this);
|
12572
12562
|
|
12573
|
-
|
12563
|
+
/***
|
12574
12564
|
Navigation feedback
|
12575
12565
|
===================
|
12576
12566
|
|
@@ -12615,7 +12605,7 @@ Once the response is received the URL will change to `/bar` and the `up-active`
|
|
12615
12605
|
var CLASS_ACTIVE, SELECTOR_SECTION, config, currentClass, findActionableArea, locationChanged, normalizeUrl, reset, sectionUrls, start, stop, u, urlSet;
|
12616
12606
|
u = up.util;
|
12617
12607
|
|
12618
|
-
|
12608
|
+
/***
|
12619
12609
|
Sets default options for this module.
|
12620
12610
|
|
12621
12611
|
@property up.feedback.config
|
@@ -12706,7 +12696,7 @@ Once the response is received the URL will change to `/bar` and the `up-active`
|
|
12706
12696
|
});
|
12707
12697
|
};
|
12708
12698
|
|
12709
|
-
|
12699
|
+
/***
|
12710
12700
|
@function findActionableArea
|
12711
12701
|
@param {string|Element|jQuery} elementOrSelector
|
12712
12702
|
@internal
|
@@ -12720,7 +12710,7 @@ Once the response is received the URL will change to `/bar` and the `up-active`
|
|
12720
12710
|
return $area;
|
12721
12711
|
};
|
12722
12712
|
|
12723
|
-
|
12713
|
+
/***
|
12724
12714
|
Marks the given element as currently loading, by assigning the CSS class [`up-active`](/a.up-active).
|
12725
12715
|
|
12726
12716
|
This happens automatically when following links or submitting forms through the Unpoly API.
|
@@ -12773,7 +12763,7 @@ Once the response is received the URL will change to `/bar` and the `up-active`
|
|
12773
12763
|
}
|
12774
12764
|
};
|
12775
12765
|
|
12776
|
-
|
12766
|
+
/***
|
12777
12767
|
Links that are currently [loading through Unpoly](/form-up-target)
|
12778
12768
|
are assigned the `up-active` class automatically.
|
12779
12769
|
Style `.up-active` in your CSS to improve the perceived responsiveness
|
@@ -12801,7 +12791,7 @@ Once the response is received the URL will change to `/bar` and the `up-active`
|
|
12801
12791
|
@stable
|
12802
12792
|
*/
|
12803
12793
|
|
12804
|
-
|
12794
|
+
/***
|
12805
12795
|
Forms that are currently [loading through Unpoly](/a-up-target)
|
12806
12796
|
are assigned the `up-active` class automatically.
|
12807
12797
|
Style `.up-active` in your CSS to improve the perceived responsiveness
|
@@ -12832,7 +12822,7 @@ Once the response is received the URL will change to `/bar` and the `up-active`
|
|
12832
12822
|
@stable
|
12833
12823
|
*/
|
12834
12824
|
|
12835
|
-
|
12825
|
+
/***
|
12836
12826
|
Marks the given element as no longer loading, by removing the CSS class [`up-active`](/a.up-active).
|
12837
12827
|
|
12838
12828
|
This happens automatically when network requests initiated by the Unpoly API have completed.
|
@@ -12849,7 +12839,7 @@ Once the response is received the URL will change to `/bar` and the `up-active`
|
|
12849
12839
|
return $element.removeClass(CLASS_ACTIVE);
|
12850
12840
|
};
|
12851
12841
|
|
12852
|
-
|
12842
|
+
/***
|
12853
12843
|
Links that point to the current location are assigned
|
12854
12844
|
the `up-current` class automatically.
|
12855
12845
|
|
@@ -12913,7 +12903,7 @@ Once the response is received the URL will change to `/bar` and the `up-active`
|
|
12913
12903
|
|
12914
12904
|
}).call(this);
|
12915
12905
|
|
12916
|
-
|
12906
|
+
/***
|
12917
12907
|
Passive updates
|
12918
12908
|
===============
|
12919
12909
|
|
@@ -12928,7 +12918,7 @@ passively receive updates from the server.
|
|
12928
12918
|
var config, hungrySelector, reset, u;
|
12929
12919
|
u = up.util;
|
12930
12920
|
|
12931
|
-
|
12921
|
+
/***
|
12932
12922
|
Configures defaults for passive updates.
|
12933
12923
|
|
12934
12924
|
@property up.radio.config
|
@@ -12952,7 +12942,7 @@ passively receive updates from the server.
|
|
12952
12942
|
return config.reset();
|
12953
12943
|
};
|
12954
12944
|
|
12955
|
-
|
12945
|
+
/***
|
12956
12946
|
@function up.radio.hungrySelector
|
12957
12947
|
@internal
|
12958
12948
|
*/
|
@@ -12960,7 +12950,7 @@ passively receive updates from the server.
|
|
12960
12950
|
return u.multiSelector(config.hungry);
|
12961
12951
|
};
|
12962
12952
|
|
12963
|
-
|
12953
|
+
/***
|
12964
12954
|
Elements with this attribute are [updated](/up.replace) whenever there is a
|
12965
12955
|
matching element found in a successful response. The element is replaced even
|
12966
12956
|
when it isn't [targeted](/a-up-target) directly.
|
@@ -12981,7 +12971,7 @@ passively receive updates from the server.
|
|
12981
12971
|
|
12982
12972
|
}).call(this);
|
12983
12973
|
|
12984
|
-
|
12974
|
+
/***
|
12985
12975
|
Play nice with Rails UJS
|
12986
12976
|
========================
|
12987
12977
|
*/
|