upjs-rails 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b76ed1c3dc06bb01b5c0458a9d7a37882465d731
4
- data.tar.gz: 40be17e194be6cd15655b875af2f7a4278d0493f
3
+ metadata.gz: 772b610a2d92e9bab9bbb3645ba43a8d54034d3a
4
+ data.tar.gz: b98035a0a638940813babac04dadb7a81d7330ff
5
5
  SHA512:
6
- metadata.gz: 719ecb782c356d473ecacb4181d38422266d2731a4c026be2b6aed7f3bd13ffbddbc11c13279d135da440350b19d836cbb8c04b2268b97707df3d460bb61fcb2
7
- data.tar.gz: ec8008f5d9c30b8553d57409b105cf7c11c2b25cd3e1848a15986d3b13540f05398ac23cb2730af55e399bcfe61ae410e3b618ae31b0bd9b4dd4563aad78baf0
6
+ metadata.gz: 74283762d6f5a9dc34ef2f10e58961f66a5155dbbfbc46667311a38a55980c579052672486df539ffd8645f9b38abc29bcbde73f87077543086369dd6c94e719
7
+ data.tar.gz: 47b081aa12d808affa5b732294043601b7209ea64919df3e34472fc36022cf25bdcf4069dc5988e073e0c16a0bbaa71ba0e53ca263e0bd2b1b26e34e8efd5b2f
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- coffee-script (2.3.0)
4
+ coffee-script (2.4.1)
5
5
  coffee-script-source
6
6
  execjs
7
- coffee-script-source (1.9.0)
8
- execjs (2.3.0)
7
+ coffee-script-source (1.9.1.1)
8
+ execjs (2.5.2)
9
9
  hike (1.2.3)
10
10
  json (1.8.2)
11
- libv8 (3.16.14.3)
11
+ libv8 (3.16.14.11)
12
12
  multi_json (1.10.1)
13
13
  rack (1.6.0)
14
14
  rake (10.4.2)
data/design/design.txt CHANGED
@@ -19,7 +19,7 @@ Gedanke 2
19
19
 
20
20
  z. B.
21
21
 
22
- up.awaken('.note_form', function($element) {
22
+ up.compiler('.note_form', function($element) {
23
23
 
24
24
  var timer = setTimeout(...)
25
25
 
data/dist/up.js CHANGED
@@ -22,10 +22,10 @@ If you use them in your own code, you will get hurt.
22
22
  */
23
23
 
24
24
  (function() {
25
- var __slice = [].slice;
25
+ var slice = [].slice;
26
26
 
27
27
  up.util = (function() {
28
- var $createElementFromSelector, ANIMATION_PROMISE_KEY, CONSOLE_PLACEHOLDERS, ajax, castsToFalse, castsToTrue, clientSize, contains, copy, copyAttributes, createElement, createElementFromHtml, createSelectorFromElement, cssAnimate, debug, detect, each, error, escapePressed, extend, findWithSelf, finishCssAnimate, forceCompositing, get, ifGiven, isArray, isBlank, isDeferred, isDefined, isElement, isFunction, isGiven, isHash, isJQuery, isMissing, isNull, isObject, isPresent, isPromise, isStandardPort, isString, isUndefined, isUnmodifiedKeyEvent, isUnmodifiedMouseEvent, keys, last, locationFromXhr, measure, merge, methodFromXhr, nextFrame, normalizeMethod, normalizeUrl, nullJquery, only, option, options, prependGhost, presence, presentAttr, resolvableWhen, resolvedDeferred, resolvedPromise, select, setMissingAttrs, stringSet, stringifyConsoleArgs, temporaryCss, times, toArray, trim, unwrap;
28
+ var $createElementFromSelector, ANIMATION_PROMISE_KEY, CONSOLE_PLACEHOLDERS, ajax, castsToFalse, castsToTrue, clientSize, contains, copy, copyAttributes, createElement, createElementFromHtml, createSelectorFromElement, cssAnimate, debug, detect, each, error, escapePressed, extend, findWithSelf, finishCssAnimate, forceCompositing, get, ifGiven, isArray, isBlank, isDeferred, isDefined, isElement, isFunction, isGiven, isHash, isJQuery, isMissing, isNull, isObject, isPresent, isPromise, isStandardPort, isString, isUndefined, isUnmodifiedKeyEvent, isUnmodifiedMouseEvent, keys, last, locationFromXhr, measure, merge, methodFromXhr, nextFrame, normalizeMethod, normalizeUrl, nullJquery, only, option, options, prependGhost, presence, presentAttr, resolvableWhen, resolvedDeferred, resolvedPromise, select, setMissingAttrs, stringSet, stringifyConsoleArgs, temporaryCss, times, toArray, trim, unwrap, warn;
29
29
  get = function(url, options) {
30
30
  options = options || {};
31
31
  options.url = url;
@@ -105,17 +105,17 @@ If you use them in your own code, you will get hurt.
105
105
  }
106
106
  };
107
107
  $createElementFromSelector = function(selector) {
108
- var $element, $parent, $root, classes, conjunction, depthSelector, expression, html, id, iteration, path, tag, _i, _j, _len, _len1;
108
+ var $element, $parent, $root, classes, conjunction, depthSelector, expression, html, id, iteration, j, k, len, len1, path, tag;
109
109
  path = selector.split(/[ >]/);
110
110
  $root = null;
111
- for (iteration = _i = 0, _len = path.length; _i < _len; iteration = ++_i) {
111
+ for (iteration = j = 0, len = path.length; j < len; iteration = ++j) {
112
112
  depthSelector = path[iteration];
113
113
  conjunction = depthSelector.match(/(^|\.|\#)[A-Za-z0-9\-_]+/g);
114
114
  tag = "div";
115
115
  classes = [];
116
116
  id = null;
117
- for (_j = 0, _len1 = conjunction.length; _j < _len1; _j++) {
118
- expression = conjunction[_j];
117
+ for (k = 0, len1 = conjunction.length; k < len1; k++) {
118
+ expression = conjunction[k];
119
119
  switch (expression[0]) {
120
120
  case ".":
121
121
  classes.push(expression.substr(1));
@@ -155,36 +155,27 @@ If you use them in your own code, you will get hurt.
155
155
  return element;
156
156
  };
157
157
  debug = function() {
158
- var args, group, message, placeHolderCount, value, _ref;
159
- args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
160
- args = toArray(args);
161
- message = args.shift();
158
+ var args, message;
159
+ message = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
162
160
  message = "[UP] " + message;
163
- placeHolderCount = ((_ref = message.match(CONSOLE_PLACEHOLDERS)) != null ? _ref.length : void 0) || 0;
164
- if (isFunction(last(args)) && placeHolderCount < args.length) {
165
- group = args.pop();
166
- }
167
- value = console.debug.apply(console, [message].concat(__slice.call(args)));
168
- if (group) {
169
- console.groupCollapsed();
170
- try {
171
- value = group();
172
- } finally {
173
- console.groupEnd();
174
- }
175
- }
176
- return value;
161
+ return console.debug.apply(console, [message].concat(slice.call(args)));
162
+ };
163
+ warn = function() {
164
+ var args, message;
165
+ message = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
166
+ message = "[UP] " + message;
167
+ return console.warn.apply(console, [message].concat(slice.call(args)));
177
168
  };
178
169
  error = function() {
179
170
  var $error, args, asString;
180
- args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
171
+ args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
181
172
  args[0] = "[UP] " + args[0];
182
173
  console.error.apply(console, args);
183
174
  asString = stringifyConsoleArgs(args);
184
175
  $error = presence($('.up-error')) || $('<div class="up-error"></div>').prependTo('body');
185
176
  $error.addClass('up-error');
186
177
  $error.text(asString);
187
- throw asString;
178
+ throw new Error(asString);
188
179
  };
189
180
  CONSOLE_PLACEHOLDERS = /\%[odisf]/g;
190
181
  stringifyConsoleArgs = function(args) {
@@ -211,7 +202,7 @@ If you use them in your own code, you will get hurt.
211
202
  });
212
203
  };
213
204
  createSelectorFromElement = function($element) {
214
- var classString, classes, id, klass, selector, _i, _len;
205
+ var classString, classes, id, j, klass, len, selector;
215
206
  debug("Creating selector from element %o", $element);
216
207
  classes = (classString = $element.attr("class")) ? classString.split(" ") : [];
217
208
  id = $element.attr("id");
@@ -219,8 +210,8 @@ If you use them in your own code, you will get hurt.
219
210
  if (id) {
220
211
  selector += "#" + id;
221
212
  }
222
- for (_i = 0, _len = classes.length; _i < _len; _i++) {
223
- klass = classes[_i];
213
+ for (j = 0, len = classes.length; j < len; j++) {
214
+ klass = classes[j];
224
215
  selector += "." + klass;
225
216
  }
226
217
  return selector;
@@ -257,10 +248,10 @@ If you use them in your own code, you will get hurt.
257
248
  extend = $.extend;
258
249
  trim = $.trim;
259
250
  keys = Object.keys || function(object) {
260
- var key, result, _i, _len;
251
+ var j, key, len, result;
261
252
  result = [];
262
- for (_i = 0, _len = object.length; _i < _len; _i++) {
263
- key = object[_i];
253
+ for (j = 0, len = object.length; j < len; j++) {
254
+ key = object[j];
264
255
  if (object.hasOwnProperty(key)) {
265
256
  result.push(key);
266
257
  }
@@ -268,21 +259,21 @@ If you use them in your own code, you will get hurt.
268
259
  return result;
269
260
  };
270
261
  each = function(collection, block) {
271
- var index, item, _i, _len, _results;
272
- _results = [];
273
- for (index = _i = 0, _len = collection.length; _i < _len; index = ++_i) {
262
+ var index, item, j, len, results;
263
+ results = [];
264
+ for (index = j = 0, len = collection.length; j < len; index = ++j) {
274
265
  item = collection[index];
275
- _results.push(block(item, index));
266
+ results.push(block(item, index));
276
267
  }
277
- return _results;
268
+ return results;
278
269
  };
279
270
  times = function(count, block) {
280
- var iteration, _i, _ref, _results;
281
- _results = [];
282
- for (iteration = _i = 0, _ref = count - 1; 0 <= _ref ? _i <= _ref : _i >= _ref; iteration = 0 <= _ref ? ++_i : --_i) {
283
- _results.push(block(iteration));
271
+ var iteration, j, ref, results;
272
+ results = [];
273
+ for (iteration = j = 0, ref = count - 1; 0 <= ref ? j <= ref : j >= ref; iteration = 0 <= ref ? ++j : --j) {
274
+ results.push(block(iteration));
284
275
  }
285
- return _results;
276
+ return results;
286
277
  };
287
278
  isNull = function(object) {
288
279
  return object === null;
@@ -396,11 +387,11 @@ If you use them in your own code, you will get hurt.
396
387
  @param {Array} args...
397
388
  */
398
389
  option = function() {
399
- var arg, args, match, value, _i, _len;
400
- args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
390
+ var arg, args, j, len, match, value;
391
+ args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
401
392
  match = null;
402
- for (_i = 0, _len = args.length; _i < _len; _i++) {
403
- arg = args[_i];
393
+ for (j = 0, len = args.length; j < len; j++) {
394
+ arg = args[j];
404
395
  value = arg;
405
396
  if (isFunction(value)) {
406
397
  value = value();
@@ -413,10 +404,10 @@ If you use them in your own code, you will get hurt.
413
404
  return match;
414
405
  };
415
406
  detect = function(array, tester) {
416
- var element, match, _i, _len;
407
+ var element, j, len, match;
417
408
  match = null;
418
- for (_i = 0, _len = array.length; _i < _len; _i++) {
419
- element = array[_i];
409
+ for (j = 0, len = array.length; j < len; j++) {
410
+ element = array[j];
420
411
  if (tester(element)) {
421
412
  match = element;
422
413
  break;
@@ -436,15 +427,15 @@ If you use them in your own code, you will get hurt.
436
427
  };
437
428
  presentAttr = function() {
438
429
  var $element, attrName, attrNames, values;
439
- $element = arguments[0], attrNames = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
430
+ $element = arguments[0], attrNames = 2 <= arguments.length ? slice.call(arguments, 1) : [];
440
431
  values = (function() {
441
- var _i, _len, _results;
442
- _results = [];
443
- for (_i = 0, _len = attrNames.length; _i < _len; _i++) {
444
- attrName = attrNames[_i];
445
- _results.push($element.attr(attrName));
432
+ var j, len, results;
433
+ results = [];
434
+ for (j = 0, len = attrNames.length; j < len; j++) {
435
+ attrName = attrNames[j];
436
+ results.push($element.attr(attrName));
446
437
  }
447
- return _results;
438
+ return results;
448
439
  })();
449
440
  return detect(values, isPresent);
450
441
  };
@@ -600,18 +591,18 @@ If you use them in your own code, you will get hurt.
600
591
  return box;
601
592
  };
602
593
  copyAttributes = function($source, $target) {
603
- var attr, _i, _len, _ref, _results;
604
- _ref = $source.get(0).attributes;
605
- _results = [];
606
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
607
- attr = _ref[_i];
594
+ var attr, j, len, ref, results;
595
+ ref = $source.get(0).attributes;
596
+ results = [];
597
+ for (j = 0, len = ref.length; j < len; j++) {
598
+ attr = ref[j];
608
599
  if (attr.specified) {
609
- _results.push($target.attr(attr.name, attr.value));
600
+ results.push($target.attr(attr.name, attr.value));
610
601
  } else {
611
- _results.push(void 0);
602
+ results.push(void 0);
612
603
  }
613
604
  }
614
- return _results;
605
+ return results;
615
606
  };
616
607
  prependGhost = function($element) {
617
608
  var $ghost, dimensions;
@@ -652,11 +643,11 @@ If you use them in your own code, you will get hurt.
652
643
  return xhr.getResponseHeader('X-Up-Method');
653
644
  };
654
645
  only = function() {
655
- var filtered, key, keys, object, _i, _len;
656
- object = arguments[0], keys = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
646
+ var filtered, j, key, keys, len, object;
647
+ object = arguments[0], keys = 2 <= arguments.length ? slice.call(arguments, 1) : [];
657
648
  filtered = {};
658
- for (_i = 0, _len = keys.length; _i < _len; _i++) {
659
- key = keys[_i];
649
+ for (j = 0, len = keys.length; j < len; j++) {
650
+ key = keys[j];
660
651
  if (object.hasOwnProperty(key)) {
661
652
  filtered[key] = object[key];
662
653
  }
@@ -691,7 +682,7 @@ If you use them in your own code, you will get hurt.
691
682
  };
692
683
  resolvableWhen = function() {
693
684
  var deferreds, joined;
694
- deferreds = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
685
+ deferreds = 1 <= arguments.length ? slice.call(arguments, 0) : [];
695
686
  joined = $.when.apply($, deferreds);
696
687
  joined.resolve = function() {
697
688
  return each(deferreds, function(deferred) {
@@ -701,20 +692,20 @@ If you use them in your own code, you will get hurt.
701
692
  return joined;
702
693
  };
703
694
  setMissingAttrs = function($element, attrs) {
704
- var key, value, _results;
705
- _results = [];
695
+ var key, results, value;
696
+ results = [];
706
697
  for (key in attrs) {
707
698
  value = attrs[key];
708
699
  if (isMissing($element.attr(key))) {
709
- _results.push($element.attr(key, value));
700
+ results.push($element.attr(key, value));
710
701
  } else {
711
- _results.push(void 0);
702
+ results.push(void 0);
712
703
  }
713
704
  }
714
- return _results;
705
+ return results;
715
706
  };
716
707
  stringSet = function(array) {
717
- var includes, includesAny, key, put, set, string, _i, _len;
708
+ var includes, includesAny, j, key, len, put, set, string;
718
709
  set = {};
719
710
  includes = function(string) {
720
711
  return set[key(string)];
@@ -728,8 +719,8 @@ If you use them in your own code, you will get hurt.
728
719
  key = function(string) {
729
720
  return "_" + string;
730
721
  };
731
- for (_i = 0, _len = array.length; _i < _len; _i++) {
732
- string = array[_i];
722
+ for (j = 0, len = array.length; j < len; j++) {
723
+ string = array[j];
733
724
  put(string);
734
725
  }
735
726
  return {
@@ -755,6 +746,7 @@ If you use them in your own code, you will get hurt.
755
746
  option: option,
756
747
  error: error,
757
748
  debug: debug,
749
+ warn: warn,
758
750
  each: each,
759
751
  times: times,
760
752
  detect: detect,
@@ -823,7 +815,7 @@ Some browser-interfacing methods and switches that we can't currently get rid of
823
815
  */
824
816
 
825
817
  (function() {
826
- var __slice = [].slice;
818
+ var slice = [].slice;
827
819
 
828
820
  up.browser = (function() {
829
821
  var canCssAnimation, canInputEvent, canPushState, ensureConsoleExists, ensureRecentJquery, isSupported, loadPage, memoize, u, url;
@@ -858,16 +850,17 @@ Some browser-interfacing methods and switches that we can't currently get rid of
858
850
  return location.href;
859
851
  };
860
852
  ensureConsoleExists = function() {
861
- var noop, _base, _base1, _base2, _base3, _base4, _base5, _base6;
853
+ var base, base1, base2, base3, base4, base5, base6, base7, noop;
862
854
  window.console || (window.console = {});
863
855
  noop = function() {};
864
- (_base = window.console).log || (_base.log = noop);
865
- (_base1 = window.console).info || (_base1.info = noop);
866
- (_base2 = window.console).error || (_base2.error = noop);
867
- (_base3 = window.console).debug || (_base3.debug = noop);
868
- (_base4 = window.console).group || (_base4.group = noop);
869
- (_base5 = window.console).groupCollapsed || (_base5.groupCollapsed = noop);
870
- return (_base6 = window.console).groupEnd || (_base6.groupEnd = noop);
856
+ (base = window.console).log || (base.log = noop);
857
+ (base1 = window.console).info || (base1.info = noop);
858
+ (base2 = window.console).error || (base2.error = noop);
859
+ (base3 = window.console).debug || (base3.debug = noop);
860
+ (base4 = window.console).warn || (base4.warn = noop);
861
+ (base5 = window.console).group || (base5.group = noop);
862
+ (base6 = window.console).groupCollapsed || (base6.groupCollapsed = noop);
863
+ return (base7 = window.console).groupEnd || (base7.groupEnd = noop);
871
864
  };
872
865
  memoize = function(func) {
873
866
  var cache, cached;
@@ -875,7 +868,7 @@ Some browser-interfacing methods and switches that we can't currently get rid of
875
868
  cached = false;
876
869
  return function() {
877
870
  var args;
878
- args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
871
+ args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
879
872
  if (cached) {
880
873
  return cache;
881
874
  } else {
@@ -965,7 +958,7 @@ We need to work on this page:
965
958
  */
966
959
 
967
960
  (function() {
968
- var __slice = [].slice;
961
+ var slice = [].slice;
969
962
 
970
963
  up.bus = (function() {
971
964
  var callbacksByEvent, callbacksFor, defaultCallbacksByEvent, emit, listen, reset, snapshot, u;
@@ -984,14 +977,14 @@ We need to work on this page:
984
977
  @method up.bus.snapshot
985
978
  */
986
979
  snapshot = function() {
987
- var callbacks, event, _results;
980
+ var callbacks, event, results;
988
981
  defaultCallbacksByEvent = {};
989
- _results = [];
982
+ results = [];
990
983
  for (event in callbacksByEvent) {
991
984
  callbacks = callbacksByEvent[event];
992
- _results.push(defaultCallbacksByEvent[event] = u.copy(callbacks));
985
+ results.push(defaultCallbacksByEvent[event] = u.copy(callbacks));
993
986
  }
994
- return _results;
987
+ return results;
995
988
  };
996
989
 
997
990
  /**
@@ -1044,7 +1037,7 @@ We need to work on this page:
1044
1037
  */
1045
1038
  emit = function() {
1046
1039
  var args, callbacks, eventName;
1047
- eventName = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
1040
+ eventName = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
1048
1041
  u.debug("Emitting event %o with args %o", eventName, args);
1049
1042
  callbacks = callbacksFor(eventName);
1050
1043
  return u.each(callbacks, function(callback) {
@@ -1214,7 +1207,7 @@ We need to work on this page:
1214
1207
 
1215
1208
  (function() {
1216
1209
  up.flow = (function() {
1217
- var autofocus, destroy, elementsInserted, findOldFragment, implant, parseImplantSteps, parseResponse, prepareForReplacement, reload, replace, reset, reveal, setSource, source, swapElements, u;
1210
+ var autofocus, destroy, elementsInserted, findOldFragment, fragmentNotFound, implant, parseImplantSteps, parseResponse, prepareForReplacement, reload, replace, reset, reveal, setSource, source, swapElements, u;
1218
1211
  u = up.util;
1219
1212
  setSource = function(element, sourceUrl) {
1220
1213
  var $element;
@@ -1301,7 +1294,16 @@ We need to work on this page:
1301
1294
  };
1302
1295
 
1303
1296
  /**
1304
- Replaces the given selector with the same CSS selector from the given HTML string.
1297
+ Updates a selector on the current page with the
1298
+ same selector from the given HTML string.
1299
+
1300
+ Example:
1301
+
1302
+ html = '<div class="before">new-before</div>' +
1303
+ '<div class="middle">new-middle</div>' +
1304
+ '<div class="after">new-after</div>';
1305
+
1306
+ up.flow.implant('.middle', html):
1305
1307
 
1306
1308
  @method up.flow.implant
1307
1309
  @protected
@@ -1315,7 +1317,7 @@ We need to work on this page:
1315
1317
  @param {String} [options.historyMethod='push']
1316
1318
  */
1317
1319
  implant = function(selector, html, options) {
1318
- var $new, $old, response, step, _i, _len, _ref, _results;
1320
+ var $new, $old, j, len, ref, response, results, step;
1319
1321
  options = u.options(options, {
1320
1322
  historyMethod: 'push'
1321
1323
  });
@@ -1328,30 +1330,38 @@ We need to work on this page:
1328
1330
  options.source = u.option(options.source, options.history);
1329
1331
  response = parseResponse(html);
1330
1332
  options.title || (options.title = response.title());
1331
- _ref = parseImplantSteps(selector, options);
1332
- _results = [];
1333
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1334
- step = _ref[_i];
1333
+ ref = parseImplantSteps(selector, options);
1334
+ results = [];
1335
+ for (j = 0, len = ref.length; j < len; j++) {
1336
+ step = ref[j];
1335
1337
  $old = findOldFragment(step.selector);
1336
1338
  $new = response.find(step.selector);
1337
- _results.push(prepareForReplacement($old, options).then(function() {
1339
+ results.push(prepareForReplacement($old, options).then(function() {
1338
1340
  return swapElements($old, $new, step.pseudoClass, step.transition, options);
1339
1341
  }));
1340
1342
  }
1341
- return _results;
1343
+ return results;
1342
1344
  };
1343
1345
  findOldFragment = function(selector) {
1344
1346
  var selectorWithExcludes;
1345
1347
  selectorWithExcludes = selector + ":not(.up-ghost, .up-destroying)";
1346
- return u.presence($(".up-popup " + selectorWithExcludes)) || u.presence($(".up-modal " + selectorWithExcludes)) || u.presence($(selectorWithExcludes)) || u.error('Could not find selector %o in current body HTML', selector);
1348
+ return u.presence($(".up-popup " + selectorWithExcludes)) || u.presence($(".up-modal " + selectorWithExcludes)) || u.presence($(selectorWithExcludes)) || fragmentNotFound(selector);
1349
+ };
1350
+ fragmentNotFound = function(selector) {
1351
+ var message;
1352
+ message = 'Could not find selector %o in current body HTML';
1353
+ if (message[0] === '#') {
1354
+ message += ' (avoid using IDs)';
1355
+ }
1356
+ return u.error(message, selector);
1347
1357
  };
1348
1358
  parseResponse = function(html) {
1349
1359
  var htmlElement;
1350
1360
  htmlElement = u.createElementFromHtml(html);
1351
1361
  return {
1352
1362
  title: function() {
1353
- var _ref;
1354
- return (_ref = htmlElement.querySelector("title")) != null ? _ref.textContent : void 0;
1363
+ var ref;
1364
+ return (ref = htmlElement.querySelector("title")) != null ? ref.textContent : void 0;
1355
1365
  },
1356
1366
  find: function(selector) {
1357
1367
  var child;
@@ -1414,25 +1424,25 @@ We need to work on this page:
1414
1424
  }
1415
1425
  };
1416
1426
  parseImplantSteps = function(selector, options) {
1417
- var comma, disjunction, i, selectorAtom, selectorParts, transition, transitionString, transitions, _i, _len, _results;
1427
+ var comma, disjunction, i, j, len, results, selectorAtom, selectorParts, transition, transitionString, transitions;
1418
1428
  transitionString = options.transition || options.animation || 'none';
1419
1429
  comma = /\ *,\ */;
1420
1430
  disjunction = selector.split(comma);
1421
1431
  if (u.isPresent(transitionString)) {
1422
1432
  transitions = transitionString.split(comma);
1423
1433
  }
1424
- _results = [];
1425
- for (i = _i = 0, _len = disjunction.length; _i < _len; i = ++_i) {
1434
+ results = [];
1435
+ for (i = j = 0, len = disjunction.length; j < len; i = ++j) {
1426
1436
  selectorAtom = disjunction[i];
1427
1437
  selectorParts = selectorAtom.match(/^(.+?)(?:\:(before|after))?$/);
1428
1438
  transition = transitions[i] || u.last(transitions);
1429
- _results.push({
1439
+ results.push({
1430
1440
  selector: selectorParts[1],
1431
1441
  pseudoClass: selectorParts[2],
1432
1442
  transition: transition
1433
1443
  });
1434
1444
  }
1435
- return _results;
1445
+ return results;
1436
1446
  };
1437
1447
  autofocus = function($element) {
1438
1448
  var $control, selector;
@@ -1557,10 +1567,10 @@ We need to work on this page:
1557
1567
  */
1558
1568
 
1559
1569
  (function() {
1560
- var __slice = [].slice;
1570
+ var slice = [].slice;
1561
1571
 
1562
1572
  up.magic = (function() {
1563
- var DESTROYABLE_CLASS, DESTROYER_KEY, applyAwakener, awaken, awakeners, compile, data, defaultAwakeners, defaultLiveDescriptions, destroy, live, liveDescriptions, onEscape, ready, reset, snapshot, u;
1573
+ var DESTROYABLE_CLASS, DESTROYER_KEY, applyCompiler, compile, compiler, compilers, data, defaultCompilers, defaultLiveDescriptions, destroy, live, liveDescriptions, onEscape, ready, reset, snapshot, u;
1564
1574
  u = up.util;
1565
1575
  DESTROYABLE_CLASS = 'up-destroyable';
1566
1576
  DESTROYER_KEY = 'up-destroyer';
@@ -1624,7 +1634,7 @@ We need to work on this page:
1624
1634
  liveDescriptions = [];
1625
1635
  defaultLiveDescriptions = null;
1626
1636
  live = function(events, selector, behavior) {
1627
- var description, _ref;
1637
+ var description, ref;
1628
1638
  if (!up.browser.isSupported()) {
1629
1639
  return;
1630
1640
  }
@@ -1634,7 +1644,7 @@ We need to work on this page:
1634
1644
  }
1635
1645
  ];
1636
1646
  liveDescriptions.push(description);
1637
- return (_ref = $(document)).on.apply(_ref, description);
1647
+ return (ref = $(document)).on.apply(ref, description);
1638
1648
  };
1639
1649
 
1640
1650
  /**
@@ -1651,24 +1661,24 @@ We need to work on this page:
1651
1661
 
1652
1662
  This Javascript will do exactly that:
1653
1663
 
1654
- up.awaken('a[rel=lightbox]', function($element) {
1664
+ up.compiler('a[rel=lightbox]', function($element) {
1655
1665
  $element.lightboxify();
1656
1666
  });
1657
1667
 
1658
- Note that within the awakener, Up.js will bind `this` to the
1668
+ Note that within the compiler, Up.js will bind `this` to the
1659
1669
  native DOM element to help you migrate your existing jQuery code to
1660
1670
  this new syntax.
1661
1671
 
1662
1672
 
1663
1673
  \#\#\#\# Custom elements
1664
1674
 
1665
- You can also use `up.awaken` to implement custom elements like this:
1675
+ You can also use `up.compiler` to implement custom elements like this:
1666
1676
 
1667
1677
  <current-time></current-time>
1668
1678
 
1669
1679
  Here is the Javascript that inserts the current time into to these elements:
1670
1680
 
1671
- up.awaken('current-time', function($element) {
1681
+ up.compiler('current-time', function($element) {
1672
1682
  var now = new Date();
1673
1683
  $element.text(now.toString()));
1674
1684
  });
@@ -1676,19 +1686,19 @@ We need to work on this page:
1676
1686
 
1677
1687
  \#\#\#\# Cleaning up after yourself
1678
1688
 
1679
- If your awakener returns a function, Up.js will use this as a *destructor* to
1689
+ If your compiler returns a function, Up.js will use this as a *destructor* to
1680
1690
  clean up if the element leaves the DOM. Note that in Up.js the same DOM ad Javascript environment
1681
1691
  will persist through many page loads, so it's important to not create
1682
1692
  [memory leaks](https://makandracards.com/makandra/31325-how-to-create-memory-leaks-in-jquery).
1683
1693
 
1684
- You should clean up after yourself whenever your awakeners have global
1694
+ You should clean up after yourself whenever your compilers have global
1685
1695
  side effects, like a [`setInterval`](https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setInterval)
1686
1696
  or event handlers bound to the document root.
1687
1697
 
1688
1698
  Here is a version of `<current-time>` that updates
1689
1699
  the time every second, and cleans up once it's done:
1690
1700
 
1691
- up.awaken('current-time', function($element) {
1701
+ up.compiler('current-time', function($element) {
1692
1702
 
1693
1703
  function update() {
1694
1704
  var now = new Date();
@@ -1722,7 +1732,7 @@ We need to work on this page:
1722
1732
 
1723
1733
  The JSON will parsed and handed to your event handler as a second argument:
1724
1734
 
1725
- up.awaken('.google-map', function($element, pins) {
1735
+ up.compiler('.google-map', function($element, pins) {
1726
1736
 
1727
1737
  var map = new google.maps.Map($element);
1728
1738
 
@@ -1740,75 +1750,77 @@ We need to work on this page:
1740
1750
 
1741
1751
  \#\#\#\# Migrating jQuery event handlers to `up.on`
1742
1752
 
1743
- Within the awakener, Up.js will bind `this` to the
1753
+ Within the compiler, Up.js will bind `this` to the
1744
1754
  native DOM element to help you migrate your existing jQuery code to
1745
1755
  this new syntax.
1746
1756
 
1747
1757
 
1748
- @method up.awaken
1758
+ @method up.compiler
1749
1759
  @param {String} selector
1750
1760
  The selector to match.
1751
1761
  @param {Boolean} [options.batch=false]
1752
1762
  If set to `true` and a fragment insertion contains multiple
1753
- elements matching the selector, `awakener` is only called once
1763
+ elements matching the selector, `compiler` is only called once
1754
1764
  with a jQuery collection containing all matching elements.
1755
- @param {Function($element, data)} awakener
1765
+ @param {Function($element, data)} compiler
1756
1766
  The function to call when a matching element is inserted.
1757
1767
  The function takes the new element as the first argument (as a jQuery object).
1758
1768
  If the element has an `up-data` attribute, its value is parsed as JSON
1759
1769
  and passed as a second argument.
1760
1770
 
1761
- The function may return another function that destroys the awakened
1762
- object when it is removed from the DOM, by clearing global state such as
1763
- time-outs and event handlers bound to the document.
1771
+ The function may return a destructor function that destroys the compiled
1772
+ object before it is removed from the DOM. The destructor is supposed to
1773
+ clear global state such as time-outs and event handlers bound to the document.
1774
+ The destructor is *not* expected to remove the element from the DOM, which
1775
+ is already handled by [`up.destroy`](/up.flow#up.destroy).
1764
1776
  */
1765
- awakeners = [];
1766
- defaultAwakeners = null;
1767
- awaken = function() {
1768
- var args, awakener, options, selector;
1769
- selector = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
1777
+ compilers = [];
1778
+ defaultCompilers = null;
1779
+ compiler = function() {
1780
+ var args, options, selector;
1781
+ selector = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
1770
1782
  if (!up.browser.isSupported()) {
1771
1783
  return;
1772
1784
  }
1773
- awakener = args.pop();
1785
+ compiler = args.pop();
1774
1786
  options = u.options(args[0], {
1775
1787
  batch: false
1776
1788
  });
1777
- return awakeners.push({
1789
+ return compilers.push({
1778
1790
  selector: selector,
1779
- callback: awakener,
1791
+ callback: compiler,
1780
1792
  batch: options.batch
1781
1793
  });
1782
1794
  };
1783
- applyAwakener = function(awakener, $jqueryElement, nativeElement) {
1795
+ applyCompiler = function(compiler, $jqueryElement, nativeElement) {
1784
1796
  var destroyer;
1785
- u.debug("Applying awakener %o on %o", awakener.selector, nativeElement);
1786
- destroyer = awakener.callback.apply(nativeElement, [$jqueryElement, data($jqueryElement)]);
1797
+ u.debug("Applying compiler %o on %o", compiler.selector, nativeElement);
1798
+ destroyer = compiler.callback.apply(nativeElement, [$jqueryElement, data($jqueryElement)]);
1787
1799
  if (u.isFunction(destroyer)) {
1788
1800
  $jqueryElement.addClass(DESTROYABLE_CLASS);
1789
1801
  return $jqueryElement.data(DESTROYER_KEY, destroyer);
1790
1802
  }
1791
1803
  };
1792
1804
  compile = function($fragment) {
1793
- var $matches, awakener, _i, _len, _results;
1805
+ var $matches, i, len, results;
1794
1806
  u.debug("Compiling fragment %o", $fragment);
1795
- _results = [];
1796
- for (_i = 0, _len = awakeners.length; _i < _len; _i++) {
1797
- awakener = awakeners[_i];
1798
- $matches = u.findWithSelf($fragment, awakener.selector);
1807
+ results = [];
1808
+ for (i = 0, len = compilers.length; i < len; i++) {
1809
+ compiler = compilers[i];
1810
+ $matches = u.findWithSelf($fragment, compiler.selector);
1799
1811
  if ($matches.length) {
1800
- if (awakener.batch) {
1801
- _results.push(applyAwakener(awakener, $matches, $matches.get()));
1812
+ if (compiler.batch) {
1813
+ results.push(applyCompiler(compiler, $matches, $matches.get()));
1802
1814
  } else {
1803
- _results.push($matches.each(function() {
1804
- return applyAwakener(awakener, $(this), this);
1815
+ results.push($matches.each(function() {
1816
+ return applyCompiler(compiler, $(this), this);
1805
1817
  }));
1806
1818
  }
1807
1819
  } else {
1808
- _results.push(void 0);
1820
+ results.push(void 0);
1809
1821
  }
1810
1822
  }
1811
- return _results;
1823
+ return results;
1812
1824
  };
1813
1825
  destroy = function($fragment) {
1814
1826
  return u.findWithSelf($fragment, "." + DESTROYABLE_CLASS).each(function() {
@@ -1838,7 +1850,7 @@ We need to work on this page:
1838
1850
 
1839
1851
  If an element annotated with [`up-data`] is inserted into the DOM,
1840
1852
  Up will parse the JSON and pass the resulting object to any matching
1841
- [`up.awaken`](/up.magic#up.magic.awaken) handlers.
1853
+ [`up.compiler`](/up.magic#up.magic.compiler) handlers.
1842
1854
 
1843
1855
  Similarly, when an event is triggered on an element annotated with
1844
1856
  [`up-data`], the parsed object will be passed to any matching
@@ -1868,7 +1880,7 @@ We need to work on this page:
1868
1880
  */
1869
1881
  snapshot = function() {
1870
1882
  defaultLiveDescriptions = u.copy(liveDescriptions);
1871
- return defaultAwakeners = u.copy(awakeners);
1883
+ return defaultCompilers = u.copy(compilers);
1872
1884
  };
1873
1885
 
1874
1886
  /**
@@ -1879,15 +1891,15 @@ We need to work on this page:
1879
1891
  @method up.magic.reset
1880
1892
  */
1881
1893
  reset = function() {
1882
- var description, _i, _len, _ref;
1883
- for (_i = 0, _len = liveDescriptions.length; _i < _len; _i++) {
1884
- description = liveDescriptions[_i];
1894
+ var description, i, len, ref;
1895
+ for (i = 0, len = liveDescriptions.length; i < len; i++) {
1896
+ description = liveDescriptions[i];
1885
1897
  if (!u.contains(defaultLiveDescriptions, description)) {
1886
- (_ref = $(document)).off.apply(_ref, description);
1898
+ (ref = $(document)).off.apply(ref, description);
1887
1899
  }
1888
1900
  }
1889
1901
  liveDescriptions = u.copy(defaultLiveDescriptions);
1890
- return awakeners = u.copy(defaultAwakeners);
1902
+ return compilers = u.copy(defaultCompilers);
1891
1903
  };
1892
1904
 
1893
1905
  /**
@@ -1923,7 +1935,7 @@ We need to work on this page:
1923
1935
  up.bus.on('framework:ready', snapshot);
1924
1936
  up.bus.on('framework:reset', reset);
1925
1937
  return {
1926
- awaken: awaken,
1938
+ compiler: compiler,
1927
1939
  on: live,
1928
1940
  ready: ready,
1929
1941
  onEscape: onEscape,
@@ -1931,12 +1943,19 @@ We need to work on this page:
1931
1943
  };
1932
1944
  })();
1933
1945
 
1934
- up.awaken = up.magic.awaken;
1946
+ up.compiler = up.magic.compiler;
1935
1947
 
1936
1948
  up.on = up.magic.on;
1937
1949
 
1938
1950
  up.ready = up.magic.ready;
1939
1951
 
1952
+ up.awaken = function() {
1953
+ var args;
1954
+ args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
1955
+ up.util.warn("up.awaken has been renamed to up.compiler and will be removed in a future version");
1956
+ return up.compiler.apply(up, args);
1957
+ };
1958
+
1940
1959
  }).call(this);
1941
1960
 
1942
1961
  /**
@@ -3200,7 +3219,7 @@ Read on
3200
3219
  @method [up-dash]
3201
3220
  @ujs
3202
3221
  */
3203
- up.awaken('[up-dash]', function($element) {
3222
+ up.compiler('[up-dash]', function($element) {
3204
3223
  var newAttrs, target;
3205
3224
  target = $element.attr('up-dash');
3206
3225
  newAttrs = {
@@ -3523,7 +3542,7 @@ We need to work on this page:
3523
3542
  @ujs
3524
3543
  @param {String} up-observe
3525
3544
  */
3526
- up.awaken('[up-observe]', function($field) {
3545
+ up.compiler('[up-observe]', function($field) {
3527
3546
  return observe($field);
3528
3547
  });
3529
3548
  return {
@@ -3841,7 +3860,7 @@ For small popup overlays ("dropdowns") see [up.popup](/up.popup) instead.
3841
3860
  */
3842
3861
 
3843
3862
  (function() {
3844
- var __slice = [].slice;
3863
+ var slice = [].slice;
3845
3864
 
3846
3865
  up.modal = (function() {
3847
3866
  var autoclose, close, config, createHiddenModal, defaults, discardHistory, open, rememberHistory, source, templateHtml, u, updated;
@@ -3984,7 +4003,7 @@ For small popup overlays ("dropdowns") see [up.popup](/up.popup) instead.
3984
4003
  */
3985
4004
  open = function() {
3986
4005
  var $link, $modal, animateOptions, animation, args, height, history, options, selector, sticky, url, width;
3987
- args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
4006
+ args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
3988
4007
  if (u.isObject(args[0]) && !u.isElement(args[0]) && !u.isJQuery(args[0])) {
3989
4008
  $link = u.nullJquery();
3990
4009
  options = args[0];
@@ -4270,7 +4289,7 @@ We need to work on this page:
4270
4289
  @method [up-tooltip]
4271
4290
  @ujs
4272
4291
  */
4273
- up.awaken('[up-tooltip]', function($link) {
4292
+ up.compiler('[up-tooltip]', function($link) {
4274
4293
  $link.on('mouseover', function() {
4275
4294
  return open($link);
4276
4295
  });
@@ -4328,13 +4347,13 @@ From Up's point of view the "current" location is either:
4328
4347
  SELECTORS_SECTION = ['a[href]', 'a[up-target]', '[up-follow]', '[up-modal]', '[up-popup]', '[up-href]'];
4329
4348
  SELECTOR_SECTION = SELECTORS_SECTION.join(', ');
4330
4349
  SELECTOR_SECTION_INSTANT = ((function() {
4331
- var _i, _len, _results;
4332
- _results = [];
4333
- for (_i = 0, _len = SELECTORS_SECTION.length; _i < _len; _i++) {
4334
- selector = SELECTORS_SECTION[_i];
4335
- _results.push(selector + "[up-instant]");
4350
+ var i, len, results;
4351
+ results = [];
4352
+ for (i = 0, len = SELECTORS_SECTION.length; i < len; i++) {
4353
+ selector = SELECTORS_SECTION[i];
4354
+ results.push(selector + "[up-instant]");
4336
4355
  }
4337
- return _results;
4356
+ return results;
4338
4357
  })()).join(', ');
4339
4358
  SELECTOR_ACTIVE = "." + CLASS_ACTIVE;
4340
4359
  normalizeUrl = function(url) {
@@ -4346,12 +4365,12 @@ From Up's point of view the "current" location is either:
4346
4365
  }
4347
4366
  };
4348
4367
  sectionUrls = function($section) {
4349
- var $link, attr, url, urls, _i, _len, _ref;
4368
+ var $link, attr, i, len, ref, url, urls;
4350
4369
  urls = [];
4351
4370
  if ($link = up.link.resolve($section)) {
4352
- _ref = ['href', 'up-follow', 'up-href'];
4353
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
4354
- attr = _ref[_i];
4371
+ ref = ['href', 'up-follow', 'up-href'];
4372
+ for (i = 0, len = ref.length; i < len; i++) {
4373
+ attr = ref[i];
4355
4374
  if (url = u.presentAttr($link, attr)) {
4356
4375
  url = normalizeUrl(url);
4357
4376
  urls.push(url);
@@ -4420,10 +4439,7 @@ For example, you might have
4420
4439
  <div up-slot class="alerts"></div>
4421
4440
 
4422
4441
  <script>
4423
- up.awaken('.alerts', function ($element) {
4424
-
4425
- RELOAD SHOULD NOT CACHE
4426
-
4442
+ up.compiler('.alerts', function ($element) {
4427
4443
  setInterval(3000, function() { up.reload('.alerts') });
4428
4444
  });
4429
4445
  </script>