ember-source 1.4.0.beta.3 → 1.4.0.beta.4

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: 8be240043accf10d4354409250994864f94969b9
4
- data.tar.gz: 6dba8529a0510282b6efec36af09861ce3bc832c
3
+ metadata.gz: 9827981fdb8ec739564a2581914b6598152c1c19
4
+ data.tar.gz: a489760dd2fd8a54616ddd0fbfc8362f138eef5a
5
5
  SHA512:
6
- metadata.gz: 11d9ea622b871334cab87380e2ee58d339bd848dd25f5381f9e00942d0907bdc1d8270fd881eba016c786eaaed6adb1b3338e5292ac47b26de9917241f4e44a1
7
- data.tar.gz: a5012ffbcecf065b270850ec13a0e63e33a720700b3424f6b51763ed988d05caad858d82d8315654c625e5c1e0876db531defd0c231c7f3ad66488d32d9e8b2f
6
+ metadata.gz: 1450bf17522964927da311b9a3e285aeadfd01f6c036a44c5d420ca15f8ddfd730d2c0af4a2472d0109b13ea7022c51a45264af2bff8c42ef919454ed01b9886
7
+ data.tar.gz: 1571b9e15cad205790bcf5996310d4afc504fd0a9be4574afc816ce70c15a1576e3833280212e6490787f25aef9a9a9bf9d3ad7d38b7dcb5de67df77cef6f426
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.0-beta.3
1
+ 1.4.0-beta.4
@@ -5,7 +5,7 @@
5
5
  * Portions Copyright 2008-2011 Apple Inc. All rights reserved.
6
6
  * @license Licensed under MIT license
7
7
  * See https://raw.github.com/emberjs/ember.js/master/LICENSE
8
- * @version 1.4.0-beta.3
8
+ * @version 1.4.0-beta.4+pre.88c597fa
9
9
  */
10
10
 
11
11
 
@@ -198,7 +198,7 @@ if (!Ember.testing) {
198
198
  * Portions Copyright 2008-2011 Apple Inc. All rights reserved.
199
199
  * @license Licensed under MIT license
200
200
  * See https://raw.github.com/emberjs/ember.js/master/LICENSE
201
- * @version 1.4.0-beta.3
201
+ * @version 1.4.0-beta.4+pre.88c597fa
202
202
  */
203
203
 
204
204
 
@@ -281,7 +281,7 @@ var define, requireModule, require, requirejs;
281
281
 
282
282
  @class Ember
283
283
  @static
284
- @version 1.4.0-beta.3
284
+ @version 1.4.0-beta.4+pre.88c597fa
285
285
  */
286
286
 
287
287
  if ('undefined' === typeof Ember) {
@@ -308,10 +308,10 @@ Ember.toString = function() { return "Ember"; };
308
308
  /**
309
309
  @property VERSION
310
310
  @type String
311
- @default '1.4.0-beta.3'
311
+ @default '1.4.0-beta.4+pre.88c597fa'
312
312
  @static
313
313
  */
314
- Ember.VERSION = '1.4.0-beta.3';
314
+ Ember.VERSION = '1.4.0-beta.4+pre.88c597fa';
315
315
 
316
316
  /**
317
317
  Standard environmental variables. You can define these in a global `EmberENV`
@@ -2933,16 +2933,6 @@ var META_KEY = Ember.META_KEY,
2933
2933
  property is not defined but the object implements the `setUnknownProperty`
2934
2934
  method then that will be invoked as well.
2935
2935
 
2936
- If you plan to run on IE8 and older browsers then you should use this
2937
- method anytime you want to set a property on an object that you don't
2938
- know for sure is private. (Properties beginning with an underscore '_'
2939
- are considered private.)
2940
-
2941
- On all newer browsers, you only need to use this method to set
2942
- properties if the property might not be defined on the object and you want
2943
- to respect the `setUnknownProperty` handler. Otherwise you can ignore this
2944
- method.
2945
-
2946
2936
  @method set
2947
2937
  @for Ember
2948
2938
  @param {Object} obj The object to modify.
@@ -3699,12 +3689,7 @@ Ember.defineProperty = function(obj, keyName, desc, data, meta) {
3699
3689
  obj[keyName] = undefined; // make enumerable
3700
3690
  }
3701
3691
 
3702
-
3703
- if (desc.func && desc._dependentCPs) {
3704
- addImplicitCPs(obj, desc._dependentCPs, meta);
3705
- }
3706
-
3707
- } else {
3692
+ } else {
3708
3693
  descs[keyName] = undefined; // shadow descriptor in proto
3709
3694
  if (desc == null) {
3710
3695
  value = data;
@@ -3740,22 +3725,6 @@ Ember.defineProperty = function(obj, keyName, desc, data, meta) {
3740
3725
  };
3741
3726
 
3742
3727
 
3743
- var addImplicitCPs = function defineImplicitCPs(obj, implicitCPs, meta) {
3744
- var cp, key, length = implicitCPs.length;
3745
-
3746
- for (var i=0; i<length; ++i) {
3747
- cp = implicitCPs[i];
3748
- key = cp.implicitCPKey;
3749
-
3750
- Ember.defineProperty(obj, key, cp, undefined, meta);
3751
-
3752
- if (cp._dependentCPs) {
3753
- addImplicitCPs(obj, cp._dependentCPs, meta);
3754
- }
3755
- }
3756
- };
3757
-
3758
-
3759
3728
  })();
3760
3729
 
3761
3730
 
@@ -4494,8 +4463,6 @@ var get = Ember.get,
4494
4463
 
4495
4464
 
4496
4465
 
4497
-
4498
-
4499
4466
  var expandProperties = Ember.expandProperties;
4500
4467
 
4501
4468
 
@@ -4658,8 +4625,9 @@ function removeDependentKeys(desc, obj, keyName, meta) {
4658
4625
  function ComputedProperty(func, opts) {
4659
4626
  this.func = func;
4660
4627
 
4661
- setDependentKeys(this, opts && opts.dependentKeys);
4628
+ this._dependentKeys = opts && opts.dependentKeys;
4662
4629
 
4630
+
4663
4631
  this._cacheable = (opts && opts.cacheable !== undefined) ? opts.cacheable : true;
4664
4632
  this._readOnly = opts && (opts.readOnly !== undefined || !!opts.readOnly);
4665
4633
  }
@@ -4670,14 +4638,6 @@ ComputedProperty.prototype = new Ember.Descriptor();
4670
4638
  var ComputedPropertyPrototype = ComputedProperty.prototype;
4671
4639
 
4672
4640
 
4673
- ComputedPropertyPrototype.toString = function() {
4674
- if (this.implicitCPKey) {
4675
- return this.implicitCPKey;
4676
- }
4677
- return Ember.Descriptor.prototype.toString.apply(this, arguments);
4678
- };
4679
-
4680
-
4681
4641
  /**
4682
4642
  Properties are cacheable by default. Computed property will automatically
4683
4643
  cache the return value of your function until one of the dependent keys changes.
@@ -4783,8 +4743,9 @@ ComputedPropertyPrototype.property = function() {
4783
4743
  }
4784
4744
 
4785
4745
 
4786
- setDependentKeys(this, args);
4746
+ this._dependentKeys = args;
4787
4747
 
4748
+
4788
4749
  return this;
4789
4750
  };
4790
4751
 
@@ -5046,84 +5007,30 @@ function getProperties(self, propertyNames) {
5046
5007
  var registerComputed, registerComputedWithProperties;
5047
5008
 
5048
5009
 
5049
- var guidFor = Ember.guidFor,
5050
- map = Ember.EnumerableUtils.map,
5051
- filter = Ember.EnumerableUtils.filter,
5052
- typeOf = Ember.typeOf;
5053
-
5054
- var implicitKey = function (cp) {
5055
- return [guidFor(cp)].concat(cp._dependentKeys).join('_');
5056
- };
5057
-
5058
- var normalizeDependentKey = function (key) {
5059
- if (key instanceof Ember.ComputedProperty) {
5060
- return implicitKey(key);
5061
- } else if (typeof key === 'string' || key instanceof String || typeof key === 'object' || typeof key === 'number') {
5062
- return key;
5063
- } else {
5064
- Ember.assert('Unexpected dependent key ' + key + ' of type ' + typeof(key), false);
5065
- }
5066
- };
5067
-
5068
- var normalizeDependentKeys = function (keys) {
5069
- return map(keys, function (key) {
5070
- return normalizeDependentKey(key);
5071
- });
5072
- };
5073
-
5074
- var selectDependentCPs = function (keys) {
5075
- return filter(keys, function (key) {
5076
- return key instanceof Ember.ComputedProperty;
5077
- });
5078
- };
5079
-
5080
- var setDependentKeys = function(cp, dependentKeys) {
5081
- if (dependentKeys) {
5082
- cp._dependentKeys = normalizeDependentKeys(dependentKeys);
5083
- cp._dependentCPs = selectDependentCPs(dependentKeys);
5084
- cp.implicitCPKey = implicitKey(cp);
5085
- } else {
5086
- cp._dependentKeys = cp._dependentCPs = [];
5087
- delete cp.implicitCPKey;
5088
- }
5089
- };
5090
- // expose `normalizeDependentKey[s]` so user CP macros can easily support
5091
- // composition
5092
- Ember.computed.normalizeDependentKey = normalizeDependentKey;
5093
- Ember.computed.normalizeDependentKeys = normalizeDependentKeys;
5094
5010
 
5095
5011
  registerComputed = function (name, macro) {
5096
5012
  Ember.computed[name] = function(dependentKey) {
5097
- var args = normalizeDependentKeys(a_slice.call(arguments));
5013
+ var args = a_slice.call(arguments);
5098
5014
  return Ember.computed(dependentKey, function() {
5099
5015
  return macro.apply(this, args);
5100
5016
  });
5101
5017
  };
5102
5018
  };
5103
5019
 
5104
-
5105
-
5106
5020
  registerComputedWithProperties = function(name, macro) {
5107
5021
  Ember.computed[name] = function() {
5108
- var args = a_slice.call(arguments);
5109
- var properties = normalizeDependentKeys(args);
5022
+ var properties = a_slice.call(arguments);
5110
5023
 
5111
5024
  var computed = Ember.computed(function() {
5112
5025
  return macro.apply(this, [getProperties(this, properties)]);
5113
5026
  });
5114
5027
 
5115
- return computed.property.apply(computed, args);
5028
+ return computed.property.apply(computed, properties);
5116
5029
  };
5117
5030
  };
5118
5031
 
5119
5032
 
5120
5033
 
5121
- Ember.computed.literal = function (value) {
5122
- return Ember.computed(function () {
5123
- return value;
5124
- });
5125
- };
5126
-
5127
5034
 
5128
5035
  /**
5129
5036
  A computed property that returns true if the value of the dependent
@@ -5654,51 +5561,6 @@ Ember.computed.oneWay = function(dependentKey) {
5654
5561
  });
5655
5562
  };
5656
5563
 
5657
- if (Ember.FEATURES.isEnabled('computed-read-only')) {
5658
- /**
5659
- Where `computed.oneWay` provides oneWay bindings, `computed.readOnly` provides
5660
- a readOnly one way binding. Very often when using `computed.oneWay` one does
5661
- not also want changes to propogate back up, as they will replace the value.
5662
-
5663
- This prevents the reverse flow, and also throws an exception when it occurs.
5664
-
5665
- Example
5666
-
5667
- ```javascript
5668
- User = Ember.Object.extend({
5669
- firstName: null,
5670
- lastName: null,
5671
- nickName: Ember.computed.readOnly('firstName')
5672
- });
5673
-
5674
- user = User.create({
5675
- firstName: 'Teddy',
5676
- lastName: 'Zeenny'
5677
- });
5678
-
5679
- user.get('nickName');
5680
- # 'Teddy'
5681
-
5682
- user.set('nickName', 'TeddyBear');
5683
- # throws Exception
5684
- # throw new Ember.Error('Cannot Set: nickName on: <User:ember27288>' );`
5685
-
5686
- user.get('firstName');
5687
- # 'Teddy'
5688
- ```
5689
-
5690
- @method computed.readOnly
5691
- @for Ember
5692
- @param {String} dependentKey
5693
- @return {Ember.ComputedProperty} computed property which creates a
5694
- one way computed property to the original value for property.
5695
- */
5696
- Ember.computed.readOnly = function(dependentKey) {
5697
- return Ember.computed(dependentKey, function() {
5698
- return get(this, dependentKey);
5699
- }).readOnly();
5700
- };
5701
- }
5702
5564
  /**
5703
5565
  A computed property that acts like a standard getter and setter,
5704
5566
  but returns the value at the provided `defaultPath` if the
@@ -6375,7 +6237,7 @@ define("backburner",
6375
6237
  return true;
6376
6238
  }
6377
6239
  }
6378
- } else if (window.toString.call(timer) === "[object Array]"){ // we're cancelling a throttle or debounce
6240
+ } else if (Object.prototype.toString.call(timer) === "[object Array]"){ // we're cancelling a throttle or debounce
6379
6241
  return this._cancelItem(findThrottler, throttlers, timer) ||
6380
6242
  this._cancelItem(findDebouncee, debouncees, timer);
6381
6243
  } else {
@@ -6489,6 +6351,7 @@ define("backburner",
6489
6351
 
6490
6352
  __exports__.Backburner = Backburner;
6491
6353
  });
6354
+
6492
6355
  })();
6493
6356
 
6494
6357
 
@@ -7985,7 +7848,7 @@ Ember.mixin = function(obj) {
7985
7848
 
7986
7849
  Note that mixins extend a constructor's prototype so arrays and object literals
7987
7850
  defined as properties will be shared amongst objects that implement the mixin.
7988
- If you want to define an property in a mixin that is not shared, you can define
7851
+ If you want to define a property in a mixin that is not shared, you can define
7989
7852
  it either as a computed property or have it be created on initialization of the object.
7990
7853
 
7991
7854
  ```javascript
@@ -12050,54 +11913,7 @@ Ember.String = {
12050
11913
  }
12051
11914
  };
12052
11915
 
12053
- if (Ember.FEATURES.isEnabled("string-humanize")) {
12054
- /**
12055
- Returns the Humanized form of a string
12056
-
12057
- Replaces underscores with spaces, and capitializes first character
12058
- of string. Also strips "_id" suffixes.
12059
-
12060
- ```javascript
12061
- 'first_name'.humanize() // 'First name'
12062
- 'user_id'.humanize() // 'User'
12063
- ```
12064
-
12065
- @method humanize
12066
- @param {String} str The string to humanize.
12067
- @return {String} The humanized string.
12068
- */
12069
-
12070
- Ember.String.humanize = function(str) {
12071
- return str.replace(/_id$/, '').
12072
- replace(/_/g, ' ').
12073
- replace(/^\w/g, function(s){
12074
- return s.toUpperCase();
12075
- });
12076
- };
12077
- }
12078
-
12079
- if (Ember.FEATURES.isEnabled("string-parameterize")) {
12080
- /**
12081
- Transforms a string so that it may be used as part of a 'pretty' / SEO friendly URL.
12082
11916
 
12083
- ```javascript
12084
- 'My favorite items.'.parameterize(); // 'my-favorite-items'
12085
- 'action_name'.parameterize(); // 'action-name'
12086
- '100 ways Ember.js is better than Angular.'.parameterize(); // '100-ways-emberjs-is-better-than-angular'
12087
- ```
12088
-
12089
- @method parameterize
12090
- @param {String} str The string to parameterize.
12091
- @return {String} the parameterized string.
12092
- */
12093
- Ember.String.parameterize = function(str) {
12094
- return str.replace(STRING_PARAMETERIZE_REGEXP_1, '-') // replace underscores, slashes and spaces with separator
12095
- .replace(STRING_PARAMETERIZE_REGEXP_2, '') // remove non-alphanumeric characters except the separator
12096
- .replace(STRING_PARAMETERIZE_REGEXP_3, '-') // replace multiple occurring separators
12097
- .replace(STRING_PARAMETERIZE_REGEXP_4, '') // trim leading and trailing separators
12098
- .toLowerCase();
12099
- };
12100
- }
12101
11917
 
12102
11918
 
12103
11919
  })();
@@ -12122,13 +11938,7 @@ var fmt = Ember.String.fmt,
12122
11938
  capitalize = Ember.String.capitalize,
12123
11939
  classify = Ember.String.classify;
12124
11940
 
12125
- if (Ember.FEATURES.isEnabled("string-humanize")) {
12126
- var humanize = Ember.String.humanize;
12127
- }
12128
11941
 
12129
- if (Ember.FEATURES.isEnabled("string-parameterize")) {
12130
- var parameterize = Ember.String.parameterize;
12131
- }
12132
11942
 
12133
11943
  if (Ember.EXTEND_PROTOTYPES === true || Ember.EXTEND_PROTOTYPES.String) {
12134
11944
 
@@ -12222,30 +12032,8 @@ if (Ember.EXTEND_PROTOTYPES === true || Ember.EXTEND_PROTOTYPES.String) {
12222
12032
  return capitalize(this);
12223
12033
  };
12224
12034
 
12225
- if (Ember.FEATURES.isEnabled("string-humanize")) {
12226
- /**
12227
- See [Ember.String.humanize](/api/classes/Ember.String.html#method_humanize).
12228
-
12229
- @method humanize
12230
- @for String
12231
- */
12232
- String.prototype.humanize = function() {
12233
- return humanize(this);
12234
- };
12235
- }
12236
-
12237
- if (Ember.FEATURES.isEnabled("string-parameterize")) {
12238
- /**
12239
- See [Ember.String.parameterize](/api/classes/Ember.String.html#method_parameterize).
12240
-
12241
- @method parameterize
12242
- @for String
12243
- */
12244
- String.prototype.parameterize = function() {
12245
- return parameterize(this);
12246
- };
12247
- }
12248
-
12035
+
12036
+
12249
12037
  }
12250
12038
 
12251
12039
 
@@ -14508,11 +14296,23 @@ Ember.Enumerable = Ember.Mixin.create({
14508
14296
  @return {Boolean} `true` if the passed function returns `true` for any item
14509
14297
  */
14510
14298
  any: function(callback, target) {
14511
- var found = this.find(function(x, idx, i) {
14512
- return !!callback.call(target, x, idx, i);
14513
- });
14299
+ var len = get(this, 'length'),
14300
+ context = popCtx(),
14301
+ found = false,
14302
+ last = null,
14303
+ next, idx;
14304
+
14305
+ if (target === undefined) { target = null; }
14306
+
14307
+ for (idx = 0; idx < len && !found; idx++) {
14308
+ next = this.nextObject(idx, last, context);
14309
+ found = callback.call(target, next, idx, this);
14310
+ last = next;
14311
+ }
14514
14312
 
14515
- return typeof found !== 'undefined';
14313
+ next = last = null;
14314
+ context = pushCtx(context);
14315
+ return found;
14516
14316
  },
14517
14317
 
14518
14318
  /**
@@ -15751,20 +15551,22 @@ ReduceComputedPropertyInstanceMeta.prototype = {
15751
15551
  setValue: function(newValue, triggerObservers) {
15752
15552
  // This lets sugars force a recomputation, handy for very simple
15753
15553
  // implementations of eg max.
15754
- if (newValue !== undefined) {
15755
- var fireObservers = triggerObservers && (newValue !== this.cache[this.propertyName]);
15554
+ if (newValue === this.cache[this.propertyName]) {
15555
+ return;
15556
+ }
15756
15557
 
15757
- if (fireObservers) {
15758
- propertyWillChange(this.context, this.propertyName);
15759
- }
15558
+ if (triggerObservers) {
15559
+ propertyWillChange(this.context, this.propertyName);
15560
+ }
15760
15561
 
15562
+ if (newValue === undefined) {
15563
+ delete this.cache[this.propertyName];
15564
+ } else {
15761
15565
  this.cache[this.propertyName] = newValue;
15566
+ }
15762
15567
 
15763
- if (fireObservers) {
15764
- propertyDidChange(this.context, this.propertyName);
15765
- }
15766
- } else {
15767
- delete this.cache[this.propertyName];
15568
+ if (triggerObservers) {
15569
+ propertyDidChange(this.context, this.propertyName);
15768
15570
  }
15769
15571
  }
15770
15572
  };
@@ -18022,7 +17824,7 @@ Ember.TargetActionSupport = Ember.Mixin.create({
18022
17824
  }).property('actionContext'),
18023
17825
 
18024
17826
  /**
18025
- Send an "action" with an "actionContext" to a "target". The action, actionContext
17827
+ Send an `action` with an `actionContext` to a `target`. The action, actionContext
18026
17828
  and target will be retrieved from properties of the object. For example:
18027
17829
 
18028
17830
  ```javascript
@@ -18502,7 +18304,7 @@ Ember.ActionHandler = Ember.Mixin.create({
18502
18304
  var hashName;
18503
18305
 
18504
18306
  if (!props._actions) {
18505
- Ember.assert(this + " 'actions' should not be a function", typeof(props.actions) !== 'function');
18307
+ Ember.assert("'actions' should not be a function", typeof(props.actions) !== 'function');
18506
18308
 
18507
18309
  if (typeOf(props.actions) === 'object') {
18508
18310
  hashName = 'actions';
@@ -21023,8 +20825,7 @@ var get = Ember.get, set = Ember.set, forEach = Ember.EnumerableUtils.forEach,
21023
20825
  ```
21024
20826
 
21025
20827
  The itemController instances will have a `parentController` property set to
21026
- either the the `parentController` property of the `ArrayController`
21027
- or to the `ArrayController` instance itself.
20828
+ to the `ArrayController` instance.
21028
20829
 
21029
20830
  @class ArrayController
21030
20831
  @namespace Ember
@@ -21125,6 +20926,15 @@ Ember.ArrayController = Ember.ArrayProxy.extend(Ember.ControllerMixin,
21125
20926
  return Ember.A();
21126
20927
  }),
21127
20928
 
20929
+ /**
20930
+ * Flag to mark as being "virtual". Used to keep this instance
20931
+ * from participating in the parentController hierarchy.
20932
+ *
20933
+ * @private
20934
+ * @type Boolean
20935
+ */
20936
+ _isVirtual: false,
20937
+
21128
20938
  controllerAt: function(idx, object, controllerClass) {
21129
20939
  var container = get(this, 'container'),
21130
20940
  subControllers = get(this, '_subControllers'),
@@ -21138,10 +20948,14 @@ Ember.ArrayController = Ember.ArrayProxy.extend(Ember.ControllerMixin,
21138
20948
  if (!container.has(fullName)) {
21139
20949
  throw new Ember.Error('Could not resolve itemController: "' + controllerClass + '"');
21140
20950
  }
21141
-
20951
+ var parentController;
20952
+ if (this._isVirtual) {
20953
+ parentController = get(this, 'parentController');
20954
+ }
20955
+ parentController = parentController || this;
21142
20956
  subController = container.lookupFactory(fullName).create({
21143
20957
  target: this,
21144
- parentController: get(this, 'parentController') || this,
20958
+ parentController: parentController,
21145
20959
  content: object
21146
20960
  });
21147
20961