upjs-rails 0.5.0 → 0.6.0

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: 6f7bdf608124ab028515e4a0147441dae647036d
4
- data.tar.gz: 3aabd26b973e811f4dcc6e1218890252e5228995
3
+ metadata.gz: c2ccc0f23f73c4e313d6da1023c151416f390e65
4
+ data.tar.gz: 5af51cde5c82b8c0166560269f9a85a151b29ee8
5
5
  SHA512:
6
- metadata.gz: 85b3c5e6216d204c72c820ee3364afc52b3369c68b6f040626ee294bac8be128f287aba1282d1cfb841ae452cebfc03e356c9e22e45cac96a873826d45ea28ed
7
- data.tar.gz: 99fbade2c3a9f8777475d202c6737d575bc6d82a9f0f9f7b7ae1b4c172cd827904e7a0eff7ae46064c412af7b5697fe3c30697072fdbf4c2934854abde7d89eb
6
+ metadata.gz: 1d68bb1397e550830d90f5163f0cdaecedb479c3d311174b45062b3ef2b5054eff94ef6d049d82618f020ddfea6f96156a7ef1b3404930ecbd3ed768355839f3
7
+ data.tar.gz: 4d389eb3cbe0ab518058375247df955f4abf32584480117c15c765aaefc348b6658aadfafafd60a85c07f8470f358fccf1b49965713d70dd2d9f8a3eca10e9df
data/dist/up.js CHANGED
@@ -397,7 +397,7 @@ If you use them in your own code, you will get hurt.
397
397
  if (isFunction(value)) {
398
398
  value = value();
399
399
  }
400
- if (isPresent(value)) {
400
+ if (isGiven(value)) {
401
401
  match = value;
402
402
  break;
403
403
  }
@@ -499,11 +499,11 @@ If you use them in your own code, you will get hurt.
499
499
  The element to animate.
500
500
  @param {Object} lastFrame
501
501
  The CSS properties that should be transitioned to.
502
- @param {Number} [opts.duration=300]
502
+ @param {Number} [options.duration=300]
503
503
  The duration of the animation, in milliseconds.
504
- @param {Number} [opts.delay=0]
504
+ @param {Number} [options.delay=0]
505
505
  The delay before the animation starts, in milliseconds.
506
- @param {String} [opts.easing='ease']
506
+ @param {String} [options.easing='ease']
507
507
  The timing function that controls the animation's acceleration.
508
508
  See [W3C documentation](http://www.w3.org/TR/css3-transitions/#transition-timing-function)
509
509
  for a list of pre-defined timing functions.
@@ -1233,15 +1233,17 @@ We need to work on this page:
1233
1233
  here, in which case a selector will be inferred from the element's class and ID.
1234
1234
  @param {String} url
1235
1235
  The URL to fetch from the server.
1236
- @param {String} [options.title]
1237
1236
  @param {String} [options.method='get']
1237
+ @param {String} [options.title]
1238
+ @param {String} [options.transition='none']
1238
1239
  @param {String|Boolean} [options.history=true]
1239
1240
  If a `String` is given, it is used as the URL the browser's location bar and history.
1240
1241
  If omitted or true, the `url` argument will be used.
1241
1242
  If set to `false`, the history will remain unchanged.
1242
1243
  @param {String|Boolean} [options.source=true]
1243
- @param {String} [options.transition]
1244
1244
  @param {String} [options.scroll='body']
1245
+ @param {Boolean} [options.cache]
1246
+ Whether to use a [cached response](/up.proxy) if available.
1245
1247
  @param {String} [options.historyMethod='push']
1246
1248
  @return {Promise}
1247
1249
  A promise that will be resolved when the page has been updated.
@@ -1259,7 +1261,8 @@ We need to work on this page:
1259
1261
  request = {
1260
1262
  url: url,
1261
1263
  method: options.method,
1262
- selector: selector
1264
+ selector: selector,
1265
+ cache: options.cache
1263
1266
  };
1264
1267
  promise = up.proxy.ajax(request);
1265
1268
  promise.done(function(html, textStatus, xhr) {
@@ -1434,19 +1437,28 @@ We need to work on this page:
1434
1437
  /**
1435
1438
  Destroys the given element or selector.
1436
1439
  Takes care that all destructors, if any, are called.
1440
+ The element is removed from the DOM.
1437
1441
 
1438
1442
  @method up.destroy
1439
1443
  @param {String|Element|jQuery} selectorOrElement
1440
- @param {String|Function|Object} [options.animation]
1441
1444
  @param {String} [options.url]
1442
1445
  @param {String} [options.title]
1446
+ @param {String} [options.animation='none']
1447
+ The animation to use before the element is removed from the DOM.
1448
+ @param {Number} [options.duration]
1449
+ The duration of the animation. See [`up.animate`](/up.motion#up.animate).
1450
+ @param {Number} [options.delay]
1451
+ The delay before the animation starts. See [`up.animate`](/up.motion#up.animate).
1452
+ @param {String} [options.easing]
1453
+ The timing function that controls the animation's acceleration. [`up.animate`](/up.motion#up.animate).
1443
1454
  */
1444
1455
  destroy = function(selectorOrElement, options) {
1445
- var $element, animationPromise;
1456
+ var $element, animateOptions, animationPromise;
1446
1457
  $element = $(selectorOrElement);
1447
1458
  options = u.options(options, {
1448
1459
  animation: 'none'
1449
1460
  });
1461
+ animateOptions = up.motion.animateOptions(options);
1450
1462
  $element.addClass('up-destroying');
1451
1463
  if (u.isPresent(options.url)) {
1452
1464
  up.history.push(options.url);
@@ -1455,7 +1467,7 @@ We need to work on this page:
1455
1467
  document.title = options.title;
1456
1468
  }
1457
1469
  up.bus.emit('fragment:destroy', $element);
1458
- animationPromise = u.presence(options.animation, u.isPromise) || up.motion.animate($element, options.animation);
1470
+ animationPromise = u.presence(options.animation, u.isPromise) || up.motion.animate($element, options.animation, animateOptions);
1459
1471
  return animationPromise.then(function() {
1460
1472
  return $element.remove();
1461
1473
  });
@@ -1465,13 +1477,21 @@ We need to work on this page:
1465
1477
  Replaces the given selector or element with a fresh copy
1466
1478
  fetched from the server.
1467
1479
 
1480
+ Up.js remembers the URL from which a fragment was loaded, so you
1481
+ don't usually need to give an URL when reloading.
1482
+
1468
1483
  @method up.reload
1469
1484
  @param {String|Element|jQuery} selectorOrElement
1485
+ @param {Object} [options]
1486
+ See options for [`up.replace`](#up.replace)
1470
1487
  */
1471
- reload = function(selectorOrElement) {
1488
+ reload = function(selectorOrElement, options) {
1472
1489
  var sourceUrl;
1473
- sourceUrl = source(selectorOrElement);
1474
- return replace(selectorOrElement, sourceUrl);
1490
+ options = u.options(options, {
1491
+ cache: false
1492
+ });
1493
+ sourceUrl = options.url || source(selectorOrElement);
1494
+ return replace(selectorOrElement, sourceUrl, options);
1475
1495
  };
1476
1496
 
1477
1497
  /**
@@ -1921,8 +1941,7 @@ We need to work on this page:
1921
1941
  - Explain how the other modules manipulate history
1922
1942
  - Decide whether we want to expose these methods as public API
1923
1943
  - Document methods and parameters
1924
-
1925
-
1944
+
1926
1945
  @class up.history
1927
1946
  */
1928
1947
 
@@ -2005,6 +2024,13 @@ Animation and transitions
2005
2024
  =========================
2006
2025
 
2007
2026
  Any fragment change in Up.js can be animated.
2027
+
2028
+ <a href="/users" data-target=".list" up-transition="cross-fade">Show users</a>
2029
+
2030
+ Or a dialog open:
2031
+
2032
+ <a href="/users" up-modal=".list" up-animation="move-from-top">Show users</a>
2033
+
2008
2034
  Up.js ships with a number of predefined animations and transitions,
2009
2035
  and you can easily define your own using Javascript or CSS.
2010
2036
 
@@ -2015,9 +2041,7 @@ We need to work on this page:
2015
2041
 
2016
2042
  - Explain the difference between transitions and animations
2017
2043
  - Demo the built-in animations and transitions
2018
- - Examples for defining your own animations and transitions
2019
2044
  - Explain ghosting
2020
- - Explain how many elements accept arguments for animation.
2021
2045
 
2022
2046
 
2023
2047
  @class up.motion
@@ -2038,10 +2062,10 @@ We need to work on this page:
2038
2062
  };
2039
2063
 
2040
2064
  /**
2041
- @method up.modal.defaults
2042
- @param {Number} [options.duration]
2043
- @param {Number} [options.delay]
2044
- @param {String} [options.easing]
2065
+ @method up.motion.defaults
2066
+ @param {Number} [options.duration=300]
2067
+ @param {Number} [options.delay=0]
2068
+ @param {String} [options.easing='ease']
2045
2069
  */
2046
2070
  defaults = function(options) {
2047
2071
  return u.extend(config, options);
@@ -2103,11 +2127,11 @@ We need to work on this page:
2103
2127
  - The animation's name
2104
2128
  - A function performing the animation
2105
2129
  - An object of CSS attributes describing the last frame of the animation
2106
- @param {Number} [opts.duration=300]
2130
+ @param {Number} [options.duration=300]
2107
2131
  The duration of the animation, in milliseconds.
2108
- @param {Number} [opts.delay=0]
2132
+ @param {Number} [options.delay=0]
2109
2133
  The delay before the animation starts, in milliseconds.
2110
- @param {String} [opts.easing='ease']
2134
+ @param {String} [options.easing='ease']
2111
2135
  The timing function that controls the animation's acceleration.
2112
2136
  See [W3C documentation](http://www.w3.org/TR/css3-transitions/#transition-timing-function)
2113
2137
  for a list of pre-defined timing functions.
@@ -2228,6 +2252,9 @@ We need to work on this page:
2228
2252
  Transitions are implement by performing two animations in parallel,
2229
2253
  causing one element to disappear and the other to appear.
2230
2254
 
2255
+ Note that the transition does not remove any elements from the DOM.
2256
+ The first element will remain in the DOM, albeit hidden using `display: none`.
2257
+
2231
2258
  \#\#\#\# Named transitions
2232
2259
 
2233
2260
  The following transitions are pre-defined:
@@ -2251,11 +2278,11 @@ We need to work on this page:
2251
2278
  @param {Element|jQuery|String} source
2252
2279
  @param {Element|jQuery|String} target
2253
2280
  @param {Function|String} transitionOrName
2254
- @param {Number} [opts.duration=300]
2281
+ @param {Number} [options.duration=300]
2255
2282
  The duration of the animation, in milliseconds.
2256
- @param {Number} [opts.delay=0]
2283
+ @param {Number} [options.delay=0]
2257
2284
  The delay before the animation starts, in milliseconds.
2258
- @param {String} [opts.easing='ease']
2285
+ @param {String} [options.easing='ease']
2259
2286
  The timing function that controls the transition's acceleration.
2260
2287
  See [W3C documentation](http://www.w3.org/TR/css3-transitions/#transition-timing-function)
2261
2288
  for a list of pre-defined timing functions.
@@ -2296,6 +2323,30 @@ We need to work on this page:
2296
2323
  /**
2297
2324
  Defines a named transition.
2298
2325
 
2326
+ Here is the definition of the pre-defined `cross-fade` animation:
2327
+
2328
+ up.transition('cross-fade', ($old, $new, options) ->
2329
+ up.motion.when(
2330
+ animate($old, 'fade-out', options),
2331
+ animate($new, 'fade-in', options)
2332
+ )
2333
+ )
2334
+
2335
+ It is recommended that your transitions use [`up.animate`](#up.animate),
2336
+ passing along the `options` that were passed to you.
2337
+
2338
+ If you choose to *not* use `up.animate` and roll your own
2339
+ logic instead, your code must honor the following contract:
2340
+
2341
+ 1. It must honor the passed options.
2342
+ 2. It must *not* remove any of the given elements from the DOM.
2343
+ 3. It returns a promise that is resolved when the transition ends
2344
+ 4. The returned promise responds to a `resolve()` function that
2345
+ instantly jumps to the last transition frame and resolves the promise.
2346
+
2347
+ Calling [`up.animate`](#up.animate) with an object argument
2348
+ will take care of all these points.
2349
+
2299
2350
  @method up.transition
2300
2351
  @param {String} name
2301
2352
  @param {Function} transition
@@ -2309,7 +2360,7 @@ We need to work on this page:
2309
2360
 
2310
2361
  Here is the definition of the pre-defined `fade-in` animation:
2311
2362
 
2312
- animation('fade-in', ($ghost, options) ->
2363
+ up.animation('fade-in', ($ghost, options) ->
2313
2364
  $ghost.css(opacity: 0)
2314
2365
  animate($ghost, { opacity: 1 }, options)
2315
2366
  )
@@ -2322,7 +2373,7 @@ We need to work on this page:
2322
2373
  animation code instead, your code must honor the following contract:
2323
2374
 
2324
2375
  1. It must honor the passed options.
2325
- 2. It must not remove the passed element from the DOM.
2376
+ 2. It must *not* remove the passed element from the DOM.
2326
2377
  3. It returns a promise that is resolved when the animation ends
2327
2378
  4. The returned promise responds to a `resolve()` function that
2328
2379
  instantly jumps to the last animation frame and resolves the promise.
@@ -2347,11 +2398,14 @@ We need to work on this page:
2347
2398
  };
2348
2399
 
2349
2400
  /**
2350
- Returns a new promise that resolves once all promises in the given array resolve.
2351
- Other then e.g. `$.then`, the combined promise will have a `resolve` method.
2401
+ Returns a new promise that resolves once all promises in arguments resolve.
2402
+
2403
+ Other then [`$.when` from jQuery](https://api.jquery.com/jquery.when/),
2404
+ the combined promise will have a `resolve` method.
2352
2405
 
2353
2406
  @method up.motion.when
2354
2407
  @param promises...
2408
+ @return A new promise.
2355
2409
  */
2356
2410
  resolvableWhen = u.resolvableWhen;
2357
2411
 
@@ -2543,7 +2597,7 @@ response will already be cached when the user performs the click.
2543
2597
 
2544
2598
  (function() {
2545
2599
  up.proxy = (function() {
2546
- var $waitingLink, SAFE_HTTP_METHODS, ajax, alias, cache, cacheKey, cancelDelay, checkPreload, clear, config, defaults, delayTimer, ensureIsIdempotent, get, isFresh, isIdempotent, normalizeRequest, preload, remove, reset, set, startDelay, timestamp, touch, trim, u;
2600
+ var $waitingLink, SAFE_HTTP_METHODS, ajax, alias, cache, cacheKey, cancelDelay, checkPreload, clear, config, defaults, delayTimer, ensureIsIdempotent, get, isFresh, isIdempotent, normalizeRequest, preload, remove, reset, set, startDelay, timestamp, trim, u;
2547
2601
  config = {
2548
2602
  preloadDelay: 75,
2549
2603
  cacheSize: 70,
@@ -2552,10 +2606,15 @@ response will already be cached when the user performs the click.
2552
2606
 
2553
2607
  /**
2554
2608
  @method up.proxy.defaults
2555
- @param {Number} [options.preloadDelay]
2556
- @param {Number} [options.cacheSize]
2557
- @param {Number} [options.cacheExpiry]
2609
+ @param {Number} [options.preloadDelay=75]
2610
+ The number of milliseconds to wait before [`[up-preload]`](#up-preload)
2611
+ starts preloading.
2612
+ @param {Number} [options.cacheSize=70]
2613
+ The maximum number of responses to cache.
2614
+ If the size is exceeded, the oldest items will be dropped from the cache.
2615
+ @param {Number} [options.cacheExpiry=300000]
2558
2616
  The number of milliseconds until a cache entry expires.
2617
+ Defaults to 5 minutes.
2559
2618
  */
2560
2619
  defaults = function(options) {
2561
2620
  return u.extend(config, options);
@@ -2626,14 +2685,20 @@ response will already be cached when the user performs the click.
2626
2685
  @param {String} request.url
2627
2686
  @param {String} [request.method='GET']
2628
2687
  @param {String} [request.selector]
2688
+ @param {Boolean} [request.cache]
2689
+ Whether to use a cached response, if available.
2690
+ If set to `false` a network connection will always be attempted.
2629
2691
  */
2630
- ajax = function(request) {
2631
- var promise;
2632
- if (!isIdempotent(request)) {
2692
+ ajax = function(options) {
2693
+ var forceCache, ignoreCache, promise, request;
2694
+ forceCache = u.castsToTrue(options.cache);
2695
+ ignoreCache = u.castsToFalse(options.cache);
2696
+ request = u.only(options, 'url', 'method', 'selector');
2697
+ if (!isIdempotent(request) && !forceCache) {
2633
2698
  clear();
2634
2699
  promise = u.ajax(request);
2635
- } else if (promise = get(request)) {
2636
- touch(promise);
2700
+ } else if (promise = get(request) && !ignoreCache) {
2701
+ promise;
2637
2702
  } else {
2638
2703
  promise = u.ajax(request);
2639
2704
  set(request, promise);
@@ -2653,9 +2718,6 @@ response will already be cached when the user performs the click.
2653
2718
  timeSinceTouch = timestamp() - promise.timestamp;
2654
2719
  return timeSinceTouch < config.cacheExpiry;
2655
2720
  };
2656
- touch = function(promise) {
2657
- return promise.timestamp = timestamp();
2658
- };
2659
2721
  get = function(request) {
2660
2722
  var key, promise;
2661
2723
  key = cacheKey(request);
@@ -2677,8 +2739,8 @@ response will already be cached when the user performs the click.
2677
2739
  var key;
2678
2740
  trim();
2679
2741
  key = cacheKey(request);
2742
+ promise.timestamp = timestamp();
2680
2743
  cache[key] = promise;
2681
- touch(promise);
2682
2744
  return promise;
2683
2745
  };
2684
2746
  remove = function(request) {
@@ -2747,6 +2809,7 @@ response will already be cached when the user performs the click.
2747
2809
  set: set,
2748
2810
  alias: alias,
2749
2811
  clear: clear,
2812
+ remove: remove,
2750
2813
  defaults: defaults
2751
2814
  };
2752
2815
  })();
@@ -2888,11 +2951,11 @@ Read on
2888
2951
  @param {Element|jQuery|String} [options.scroll]
2889
2952
  An element or selector that will be scrolled to the top in
2890
2953
  case the replaced element is not visible in the viewport.
2891
- @param {Number} [opts.duration]
2954
+ @param {Number} [options.duration]
2892
2955
  The duration of the transition. See [`up.morph`](/up.motion#up.morph).
2893
- @param {Number} [opts.delay]
2956
+ @param {Number} [options.delay]
2894
2957
  The delay before the transition starts. See [`up.morph`](/up.motion#up.morph).
2895
- @param {String} [opts.easing]
2958
+ @param {String} [options.easing]
2896
2959
  The timing function that controls the transition's acceleration. [`up.morph`](/up.motion#up.morph).
2897
2960
  */
2898
2961
  follow = function(link, options) {
@@ -2904,6 +2967,7 @@ Read on
2904
2967
  options.transition = u.option(options.transition, $link.attr('up-transition'), $link.attr('up-animation'));
2905
2968
  options.history = u.option(options.history, $link.attr('up-history'));
2906
2969
  options.scroll = u.option(options.scroll, $link.attr('up-scroll'), 'body');
2970
+ options.cache = u.option(options.cache, $link.attr('up-cache'));
2907
2971
  options = u.merge(options, up.motion.animateOptions(options, $link));
2908
2972
  return up.replace(selector, url, options);
2909
2973
  };
@@ -3179,17 +3243,19 @@ We need to work on this page:
3179
3243
  @param {String} [options.failTransition='none']
3180
3244
  The transition to use when a failed form submission updates the `options.failTarget` selector.
3181
3245
  Defaults to the form's `up-fail-transition` attribute, or to `options.transition`, or to `'none'`.
3182
- @param {Number} [opts.duration]
3246
+ @param {Number} [options.duration]
3183
3247
  The duration of the transition. See [`up.morph`](/up.motion#up.morph).
3184
- @param {Number} [opts.delay]
3248
+ @param {Number} [options.delay]
3185
3249
  The delay before the transition starts. See [`up.morph`](/up.motion#up.morph).
3186
- @param {String} [opts.easing]
3250
+ @param {String} [options.easing]
3187
3251
  The timing function that controls the transition's acceleration. [`up.morph`](/up.motion#up.morph).
3252
+ @param {Boolean} [options.cache]
3253
+ Whether to accept a cached response.
3188
3254
  @return {Promise}
3189
3255
  A promise for the AJAX response
3190
3256
  */
3191
3257
  submit = function(formOrSelector, options) {
3192
- var $form, animateOptions, failureSelector, failureTransition, historyOption, httpMethod, request, successSelector, successTransition, successUrl, url;
3258
+ var $form, animateOptions, failureSelector, failureTransition, historyOption, httpMethod, request, successSelector, successTransition, successUrl, url, useCache;
3193
3259
  $form = $(formOrSelector).closest('form');
3194
3260
  options = u.options(options);
3195
3261
  successSelector = u.option(options.target, $form.attr('up-target'), 'body');
@@ -3201,6 +3267,7 @@ We need to work on this page:
3201
3267
  failureTransition = u.option(options.failTransition, $form.attr('up-fail-transition'), successTransition);
3202
3268
  httpMethod = u.option(options.method, $form.attr('up-method'), $form.attr('data-method'), $form.attr('method'), 'post').toUpperCase();
3203
3269
  animateOptions = up.motion.animateOptions(options, $form);
3270
+ useCache = u.option(options.cache, $form.attr('up-cache'));
3204
3271
  url = u.option(options.url, $form.attr('action'), up.browser.url());
3205
3272
  $form.addClass('up-active');
3206
3273
  if (!up.browser.canPushState() && !u.castsToFalse(historyOption)) {
@@ -3211,7 +3278,8 @@ We need to work on this page:
3211
3278
  url: url,
3212
3279
  type: httpMethod,
3213
3280
  data: $form.serialize(),
3214
- selector: successSelector
3281
+ selector: successSelector,
3282
+ cache: useCache
3215
3283
  };
3216
3284
  successUrl = function(xhr) {
3217
3285
  var currentLocation;
@@ -3530,11 +3598,11 @@ We need to work on this page:
3530
3598
  @param {String} [options.origin='bottom-right']
3531
3599
  @param {String} [options.animation]
3532
3600
  The animation to use when opening the popup.
3533
- @param {Number} [opts.duration]
3601
+ @param {Number} [options.duration]
3534
3602
  The duration of the animation. See [`up.animate`](/up.motion#up.animate).
3535
- @param {Number} [opts.delay]
3603
+ @param {Number} [options.delay]
3536
3604
  The delay before the animation starts. See [`up.animate`](/up.motion#up.animate).
3537
- @param {String} [opts.easing]
3605
+ @param {String} [options.easing]
3538
3606
  The timing function that controls the animation's acceleration. [`up.animate`](/up.motion#up.animate).
3539
3607
  @param {Boolean} [options.sticky=false]
3540
3608
  If set to `true`, the popup remains
@@ -3800,11 +3868,11 @@ For small popup overlays ("dropdowns") see [up.popup](/up.popup) instead.
3800
3868
  @param {Object} [options.history=true]
3801
3869
  @param {String} [options.animation]
3802
3870
  The animation to use when opening the modal.
3803
- @param {Number} [opts.duration]
3871
+ @param {Number} [options.duration]
3804
3872
  The duration of the animation. See [`up.animate`](/up.motion#up.animate).
3805
- @param {Number} [opts.delay]
3873
+ @param {Number} [options.delay]
3806
3874
  The delay before the animation starts. See [`up.animate`](/up.motion#up.animate).
3807
- @param {String} [opts.easing]
3875
+ @param {String} [options.easing]
3808
3876
  The timing function that controls the animation's acceleration. [`up.animate`](/up.motion#up.animate).
3809
3877
  @return {Promise}
3810
3878
  A promise that will be resolved when the modal has finished loading.
@@ -4236,27 +4304,54 @@ From Up's point of view the "current" location is either:
4236
4304
  }).call(this);
4237
4305
 
4238
4306
  /**
4239
- Markers
4240
- =======
4241
-
4307
+ Content slots
4308
+ =============
4309
+
4310
+ It can be useful to mark "slots" in your page layout where you expect
4311
+ content to appear in the future.
4312
+
4313
+ For example, you might have
4314
+
4315
+ <div up-slot class="alerts"></div>
4316
+
4317
+ <script>
4318
+ up.awaken('.alerts', function ($element) {
4319
+
4320
+ RELOAD SHOULD NOT CACHE
4321
+
4322
+ setInterval(3000, function() { up.reload('.alerts') });
4323
+ });
4324
+ </script>
4325
+
4326
+ Seeing that the `.alerts` container is empty, Up.js will hide it:
4327
+
4328
+ <div class="alerts" up-slot style="display: none"></div>
4329
+
4330
+ As soon as you
4331
+
4332
+ <div class="alerts" up-slot>
4333
+ Meeting at 11:30 AM
4334
+ </div>
4335
+
4336
+
4242
4337
  TODO: Write some documentation
4243
4338
 
4244
- @class up.marker
4339
+ @class up.slot
4245
4340
  */
4246
4341
 
4247
4342
  (function() {
4248
- up.marker = (function() {
4343
+ up.slot = (function() {
4249
4344
  var check, hasContent, u;
4250
4345
  u = up.util;
4251
- hasContent = function($marker) {
4252
- return u.trim($marker.html()) !== '';
4346
+ hasContent = function($slot) {
4347
+ return u.trim($slot.html()) !== '';
4253
4348
  };
4254
4349
  check = function($element) {
4255
- return u.findWithSelf($element, '[up-marker]').each(function() {
4256
- var $marker;
4257
- $marker = $(this);
4258
- if (!hasContent($marker)) {
4259
- return $marker.hide();
4350
+ return u.findWithSelf($element, '[up-slot]').each(function() {
4351
+ var $slot;
4352
+ $slot = $(this);
4353
+ if (!hasContent($slot)) {
4354
+ return $slot.hide();
4260
4355
  }
4261
4356
  });
4262
4357
  };
@@ -4272,7 +4367,7 @@ TODO: Write some documentation
4272
4367
  This is useful to prevent the element from applying unwanted
4273
4368
  margins to the surrounding page flow.
4274
4369
 
4275
- @method [up-marker]
4370
+ @method [up-slot]
4276
4371
  @ujs
4277
4372
  */
4278
4373
  return up.bus.on('fragment:ready', check);