ember-source 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ember-source might be problematic. Click here for more details.

@@ -1,7 +1,7 @@
1
1
  (function() {
2
2
  var Ember = { assert: function() {} };
3
- // Version: v1.0.0-rc.1-188-gb6bb967
4
- // Last commit: b6bb967 (2013-03-16 18:09:42 -0700)
3
+ // Version: v1.0.0-rc.1-240-gd3a6cc4
4
+ // Last commit: d3a6cc4 (2013-03-25 04:06:07 -0400)
5
5
 
6
6
 
7
7
  (function() {
@@ -142,6 +142,7 @@ Ember.deprecate = function(message, test) {
142
142
  @method deprecateFunc
143
143
  @param {String} message A description of the deprecation.
144
144
  @param {Function} func The function to be deprecated.
145
+ @return {Function} a new function that wrapped the original function with a deprecation warning
145
146
  */
146
147
  Ember.deprecateFunc = function(message, func) {
147
148
  return function() {
@@ -1,5 +1,5 @@
1
- // Version: v1.0.0-rc.1-188-gb6bb967
2
- // Last commit: b6bb967 (2013-03-16 18:09:42 -0700)
1
+ // Version: v1.0.0-rc.1-240-gd3a6cc4
2
+ // Last commit: d3a6cc4 (2013-03-25 04:06:07 -0400)
3
3
 
4
4
 
5
5
  (function() {
@@ -140,6 +140,7 @@ Ember.deprecate = function(message, test) {
140
140
  @method deprecateFunc
141
141
  @param {String} message A description of the deprecation.
142
142
  @param {Function} func The function to be deprecated.
143
+ @return {Function} a new function that wrapped the original function with a deprecation warning
143
144
  */
144
145
  Ember.deprecateFunc = function(message, func) {
145
146
  return function() {
@@ -150,8 +151,8 @@ Ember.deprecateFunc = function(message, func) {
150
151
 
151
152
  })();
152
153
 
153
- // Version: v1.0.0-rc.1-203-ga1cbd22
154
- // Last commit: a1cbd22 (2013-03-18 10:31:41 -0700)
154
+ // Version: v1.0.0-rc.1-275-g9104bf1
155
+ // Last commit: 9104bf1 (2013-03-29 13:59:19 -0700)
155
156
 
156
157
 
157
158
  (function() {
@@ -211,7 +212,7 @@ var define, requireModule;
211
212
 
212
213
  @class Ember
213
214
  @static
214
- @version 1.0.0-rc.1
215
+ @version 1.0.0-rc.2
215
216
  */
216
217
 
217
218
  if ('undefined' === typeof Ember) {
@@ -238,10 +239,10 @@ Ember.toString = function() { return "Ember"; };
238
239
  /**
239
240
  @property VERSION
240
241
  @type String
241
- @default '1.0.0-rc.1'
242
+ @default '1.0.0-rc.2'
242
243
  @final
243
244
  */
244
- Ember.VERSION = '1.0.0-rc.1';
245
+ Ember.VERSION = '1.0.0-rc.2';
245
246
 
246
247
  /**
247
248
  Standard environmental variables. You can define these in a global `ENV`
@@ -824,7 +825,7 @@ if (isDefinePropertySimulated) {
824
825
  @param {Object} obj The object to retrieve meta for
825
826
  @param {Boolean} [writable=true] Pass `false` if you do not intend to modify
826
827
  the meta hash, allowing the method to avoid making an unnecessary copy.
827
- @return {Hash}
828
+ @return {Object} the meta hash for an object
828
829
  */
829
830
  Ember.meta = function meta(obj, writable) {
830
831
 
@@ -976,7 +977,7 @@ Ember.wrap = function(func, superFunc) {
976
977
  @method isArray
977
978
  @for Ember
978
979
  @param {Object} obj The object to test
979
- @return {Boolean}
980
+ @return {Boolean} true if the passed object is an array or Array-like
980
981
  */
981
982
  Ember.isArray = function(obj) {
982
983
  if (!obj || obj.setInterval) { return false; }
@@ -3370,6 +3371,7 @@ var ComputedPropertyPrototype = ComputedProperty.prototype;
3370
3371
 
3371
3372
  @method cacheable
3372
3373
  @param {Boolean} aFlag optional set to `false` to disable caching
3374
+ @return {Ember.ComputedProperty} this
3373
3375
  @chainable
3374
3376
  */
3375
3377
  ComputedPropertyPrototype.cacheable = function(aFlag) {
@@ -3390,6 +3392,7 @@ ComputedPropertyPrototype.cacheable = function(aFlag) {
3390
3392
  ```
3391
3393
 
3392
3394
  @method volatile
3395
+ @return {Ember.ComputedProperty} this
3393
3396
  @chainable
3394
3397
  */
3395
3398
  ComputedPropertyPrototype.volatile = function() {
@@ -3411,6 +3414,7 @@ ComputedPropertyPrototype.volatile = function() {
3411
3414
  ```
3412
3415
 
3413
3416
  @method readOnly
3417
+ @return {Ember.ComputedProperty} this
3414
3418
  @chainable
3415
3419
  */
3416
3420
  ComputedPropertyPrototype.readOnly = function(readOnly) {
@@ -3435,6 +3439,7 @@ ComputedPropertyPrototype.readOnly = function(readOnly) {
3435
3439
 
3436
3440
  @method property
3437
3441
  @param {String} path* zero or more property paths
3442
+ @return {Ember.ComputedProperty} this
3438
3443
  @chainable
3439
3444
  */
3440
3445
  ComputedPropertyPrototype.property = function() {
@@ -3664,6 +3669,7 @@ Ember.computed = function(func) {
3664
3669
  @param {Object} obj the object whose property you want to check
3665
3670
  @param {String} key the name of the property whose cached value you want
3666
3671
  to return
3672
+ @return {any} the cached value
3667
3673
  */
3668
3674
  Ember.cacheFor = function cacheFor(obj, key) {
3669
3675
  var cache = metaFor(obj, false).cache;
@@ -3673,57 +3679,238 @@ Ember.cacheFor = function cacheFor(obj, key) {
3673
3679
  }
3674
3680
  };
3675
3681
 
3682
+ function getProperties(self, propertyNames) {
3683
+ var ret = {};
3684
+ for(var i = 0; i < propertyNames.length; i++) {
3685
+ ret[propertyNames[i]] = get(self, propertyNames[i]);
3686
+ }
3687
+ return ret;
3688
+ }
3689
+
3690
+ function registerComputed(name, macro) {
3691
+ Ember.computed[name] = function(dependentKey) {
3692
+ var args = a_slice.call(arguments);
3693
+ return Ember.computed(dependentKey, function() {
3694
+ return macro.apply(this, args);
3695
+ });
3696
+ };
3697
+ }
3698
+
3699
+ function registerComputedWithProperties(name, macro) {
3700
+ Ember.computed[name] = function() {
3701
+ var properties = a_slice.call(arguments);
3702
+
3703
+ var computed = Ember.computed(function() {
3704
+ return macro.apply(this, [getProperties(this, properties)]);
3705
+ });
3706
+
3707
+ return computed.property.apply(computed, properties);
3708
+ };
3709
+ }
3710
+
3676
3711
  /**
3677
- @method computed.not
3712
+ @method computed.empty
3678
3713
  @for Ember
3679
3714
  @param {String} dependentKey
3715
+ @return {Ember.ComputedProperty} computed property which negate
3716
+ the original value for property
3680
3717
  */
3681
- Ember.computed.not = function(dependentKey) {
3682
- return Ember.computed(dependentKey, function(key) {
3683
- return !get(this, dependentKey);
3684
- });
3685
- };
3718
+ registerComputed('empty', function(dependentKey) {
3719
+ return Ember.isEmpty(get(this, dependentKey));
3720
+ });
3721
+
3722
+ /**
3723
+ @method computed.notEmpty
3724
+ @for Ember
3725
+ @param {String} dependentKey
3726
+ @return {Ember.ComputedProperty} computed property which returns true if
3727
+ original value for property is not empty.
3728
+ */
3729
+ registerComputed('notEmpty', function(dependentKey) {
3730
+ return !Ember.isEmpty(get(this, dependentKey));
3731
+ });
3686
3732
 
3687
3733
  /**
3688
3734
  @method computed.none
3689
3735
  @for Ember
3690
3736
  @param {String} dependentKey
3737
+ @return {Ember.ComputedProperty} computed property which
3738
+ rturns true if original value for property is null or undefined.
3691
3739
  */
3692
- Ember.computed.none = function(dependentKey) {
3693
- return Ember.computed(dependentKey, function(key) {
3694
- var val = get(this, dependentKey);
3695
- return Ember.isNone(val);
3696
- });
3697
- };
3740
+ registerComputed('none', function(dependentKey) {
3741
+ return Ember.isNone(get(this, dependentKey));
3742
+ });
3698
3743
 
3699
3744
  /**
3700
- @method computed.empty
3745
+ @method computed.not
3701
3746
  @for Ember
3702
3747
  @param {String} dependentKey
3748
+ @return {Ember.ComputedProperty} computed property which returns
3749
+ inverse of the original value for property
3703
3750
  */
3704
- Ember.computed.empty = function(dependentKey) {
3705
- return Ember.computed(dependentKey, function(key) {
3706
- var val = get(this, dependentKey);
3707
- return Ember.isEmpty(val);
3708
- });
3709
- };
3751
+ registerComputed('not', function(dependentKey) {
3752
+ return !get(this, dependentKey);
3753
+ });
3710
3754
 
3711
3755
  /**
3712
3756
  @method computed.bool
3713
3757
  @for Ember
3714
3758
  @param {String} dependentKey
3759
+ @return {Ember.ComputedProperty} computed property which convert
3760
+ to boolean the original value for property
3715
3761
  */
3716
- Ember.computed.bool = function(dependentKey) {
3717
- return Ember.computed(dependentKey, function(key) {
3718
- return !!get(this, dependentKey);
3719
- });
3720
- };
3762
+ registerComputed('bool', function(dependentKey) {
3763
+ return !!get(this, dependentKey);
3764
+ });
3721
3765
 
3722
3766
  /**
3723
- @method computed.alias
3767
+ @method computed.match
3768
+ @for Ember
3769
+ @param {String} dependentKey
3770
+ @param {RegExp} regexp
3771
+ @return {Ember.ComputedProperty} computed property which match
3772
+ the original value for property against a given RegExp
3773
+ */
3774
+ registerComputed('match', function(dependentKey, regexp) {
3775
+ var value = get(this, dependentKey);
3776
+ return typeof value === 'string' ? !!value.match(regexp) : false;
3777
+ });
3778
+
3779
+ /**
3780
+ @method computed.equal
3781
+ @for Ember
3782
+ @param {String} dependentKey
3783
+ @param {String|Number|Object} value
3784
+ @return {Ember.ComputedProperty} computed property which returns true if
3785
+ the original value for property is equal to the given value.
3786
+ */
3787
+ registerComputed('equal', function(dependentKey, value) {
3788
+ return get(this, dependentKey) === value;
3789
+ });
3790
+
3791
+ /**
3792
+ @method computed.gt
3793
+ @for Ember
3794
+ @param {String} dependentKey
3795
+ @param {Number} value
3796
+ @return {Ember.ComputedProperty} computed property which returns true if
3797
+ the original value for property is greater then given value.
3798
+ */
3799
+ registerComputed('gt', function(dependentKey, value) {
3800
+ return get(this, dependentKey) > value;
3801
+ });
3802
+
3803
+ /**
3804
+ @method computed.gte
3805
+ @for Ember
3806
+ @param {String} dependentKey
3807
+ @param {Number} value
3808
+ @return {Ember.ComputedProperty} computed property which returns true if
3809
+ the original value for property is greater or equal then given value.
3810
+ */
3811
+ registerComputed('gte', function(dependentKey, value) {
3812
+ return get(this, dependentKey) >= value;
3813
+ });
3814
+
3815
+ /**
3816
+ @method computed.lt
3817
+ @for Ember
3818
+ @param {String} dependentKey
3819
+ @param {Number} value
3820
+ @return {Ember.ComputedProperty} computed property which returns true if
3821
+ the original value for property is less then given value.
3822
+ */
3823
+ registerComputed('lt', function(dependentKey, value) {
3824
+ return get(this, dependentKey) < value;
3825
+ });
3826
+
3827
+ /**
3828
+ @method computed.lte
3829
+ @for Ember
3830
+ @param {String} dependentKey
3831
+ @param {Number} value
3832
+ @return {Ember.ComputedProperty} computed property which returns true if
3833
+ the original value for property is less or equal then given value.
3834
+ */
3835
+ registerComputed('lte', function(dependentKey, value) {
3836
+ return get(this, dependentKey) <= value;
3837
+ });
3838
+
3839
+ /**
3840
+ @method computed.and
3841
+ @for Ember
3842
+ @param {String} dependentKey, [dependentKey...]
3843
+ @return {Ember.ComputedProperty} computed property which peforms
3844
+ a logical `and` on the values of all the original values for properties.
3845
+ */
3846
+ registerComputedWithProperties('and', function(properties) {
3847
+ for (var key in properties) {
3848
+ if (properties.hasOwnProperty(key) && !properties[key]) {
3849
+ return false;
3850
+ }
3851
+ }
3852
+ return true;
3853
+ });
3854
+
3855
+ /**
3856
+ @method computed.or
3857
+ @for Ember
3858
+ @param {String} dependentKey, [dependentKey...]
3859
+ @return {Ember.ComputedProperty} computed property which peforms
3860
+ a logical `or` on the values of all the original values for properties.
3861
+ */
3862
+ registerComputedWithProperties('or', function(properties) {
3863
+ for (var key in properties) {
3864
+ if (properties.hasOwnProperty(key) && properties[key]) {
3865
+ return true;
3866
+ }
3867
+ }
3868
+ return false;
3869
+ });
3870
+
3871
+ /**
3872
+ @method computed.any
3873
+ @for Ember
3874
+ @param {String} dependentKey, [dependentKey...]
3875
+ @return {Ember.ComputedProperty} computed property which returns
3876
+ the first trouthy value of given list of properties.
3877
+ */
3878
+ registerComputedWithProperties('any', function(properties) {
3879
+ for (var key in properties) {
3880
+ if (properties.hasOwnProperty(key) && properties[key]) {
3881
+ return properties[key];
3882
+ }
3883
+ }
3884
+ return null;
3885
+ });
3886
+
3887
+ /**
3888
+ @method computed.map
3724
3889
  @for Ember
3890
+ @param {String} dependentKey, [dependentKey...]
3891
+ @return {Ember.ComputedProperty} computed property which maps
3892
+ values of all passed properties in to an array.
3893
+ */
3894
+ registerComputedWithProperties('map', function(properties) {
3895
+ var res = [];
3896
+ for (var key in properties) {
3897
+ if (properties.hasOwnProperty(key)) {
3898
+ if (Ember.isNone(properties[key])) {
3899
+ res.push(null);
3900
+ } else {
3901
+ res.push(properties[key]);
3902
+ }
3903
+ }
3904
+ }
3905
+ return res;
3906
+ });
3725
3907
 
3908
+ /**
3909
+ @method computed.alias
3910
+ @for Ember
3726
3911
  @param {String} dependentKey
3912
+ @return {Ember.ComputedProperty} computed property which creates an
3913
+ alias to the original value for property.
3727
3914
  */
3728
3915
  Ember.computed.alias = function(dependentKey) {
3729
3916
  return Ember.computed(dependentKey, function(key, value){
@@ -3736,6 +3923,23 @@ Ember.computed.alias = function(dependentKey) {
3736
3923
  });
3737
3924
  };
3738
3925
 
3926
+ /**
3927
+ @method computed.defaultTo
3928
+ @for Ember
3929
+ @param {String} defaultPath
3930
+ @return {Ember.ComputedProperty} computed property which acts like
3931
+ a standard getter and setter, but defaults to the value from `defaultPath`.
3932
+ */
3933
+ Ember.computed.defaultTo = function(defaultPath) {
3934
+ return Ember.computed(function(key, newValue, cachedValue) {
3935
+ var result;
3936
+ if (arguments.length === 1) {
3937
+ return cachedValue != null ? cachedValue : get(this, defaultPath);
3938
+ }
3939
+ return newValue != null ? newValue : get(this, defaultPath);
3940
+ });
3941
+ };
3942
+
3739
3943
  })();
3740
3944
 
3741
3945
 
@@ -4568,8 +4772,7 @@ function invokeLaterTimers() {
4568
4772
  If you pass a string it will be resolved on the
4569
4773
  target at the time the method is invoked.
4570
4774
  @param {Object} [args*] Optional arguments to pass to the timeout.
4571
- @param {Number} wait
4572
- Number of milliseconds to wait.
4775
+ @param {Number} wait Number of milliseconds to wait.
4573
4776
  @return {String} a string you can use to cancel the timer in
4574
4777
  {{#crossLink "Ember/run.cancel"}}{{/crossLink}} later.
4575
4778
  */
@@ -4691,15 +4894,54 @@ Ember.run.scheduleOnce = function(queue, target, method, args) {
4691
4894
  };
4692
4895
 
4693
4896
  /**
4694
- Schedules an item to run after control has been returned to the system.
4695
- This is equivalent to calling `Ember.run.later` with a wait time of 1ms.
4897
+ Schedules an item to run from within a separate run loop, after
4898
+ control has been returned to the system. This is equivalent to calling
4899
+ `Ember.run.later` with a wait time of 1ms.
4696
4900
 
4697
4901
  ```javascript
4698
4902
  Ember.run.next(myContext, function(){
4699
- // code to be executed in the next RunLoop, which will be scheduled after the current one
4903
+ // code to be executed in the next run loop, which will be scheduled after the current one
4700
4904
  });
4701
4905
  ```
4702
4906
 
4907
+ Multiple operations scheduled with `Ember.run.next` will coalesce
4908
+ into the same later run loop, along with any other operations
4909
+ scheduled by `Ember.run.later` that expire right around the same
4910
+ time that `Ember.run.next` operations will fire.
4911
+
4912
+ Note that there are often alternatives to using `Ember.run.next`.
4913
+ For instance, if you'd like to schedule an operation to happen
4914
+ after all DOM element operations have completed within the current
4915
+ run loop, you can make use of the `afterRender` run loop queue (added
4916
+ by the `ember-views` package, along with the preceding `render` queue
4917
+ where all the DOM element operations happen). Example:
4918
+
4919
+ ```javascript
4920
+ App.MyCollectionView = Ember.CollectionView.extend({
4921
+ didInsertElement: function() {
4922
+ Ember.run.scheduleOnce('afterRender', this, 'processChildElements');
4923
+ },
4924
+ processChildElements: function() {
4925
+ // ... do something with collectionView's child view
4926
+ // elements after they've finished rendering, which
4927
+ // can't be done within the CollectionView's
4928
+ // `didInsertElement` hook because that gets run
4929
+ // before the child elements have been added to the DOM.
4930
+ }
4931
+ });
4932
+ ```
4933
+
4934
+ One benefit of the above approach compared to using `Ember.run.next` is
4935
+ that you will be able to perform DOM/CSS operations before unprocessed
4936
+ elements are rendered to the screen, which may prevent flickering or
4937
+ other artifacts caused by delaying processing until after rendering.
4938
+
4939
+ The other major benefit to the above approach is that `Ember.run.next`
4940
+ introduces an element of non-determinism, which can make things much
4941
+ harder to test, due to its reliance on `setTimeout`; it's much harder
4942
+ to guarantee the order of scheduled operations when they are scheduled
4943
+ outside of the current run loop, i.e. with `Ember.run.next`.
4944
+
4703
4945
  @method next
4704
4946
  @param {Object} [target] target of method to invoke
4705
4947
  @param {Function|String} method The method to invoke.
@@ -4866,6 +5108,10 @@ Binding.prototype = {
4866
5108
  return this;
4867
5109
  },
4868
5110
 
5111
+ /**
5112
+ @method toString
5113
+ @return {String} string representation of binding
5114
+ */
4869
5115
  toString: function() {
4870
5116
  var oneWay = this._oneWay ? '[oneWay]' : '';
4871
5117
  return "Ember.Binding<" + guidFor(this) + ">(" + this._from + " -> " + this._to + ")" + oneWay;
@@ -6254,7 +6500,7 @@ define("container",
6254
6500
  factory = name;
6255
6501
  fullName = type;
6256
6502
  } else {
6257
- Ember.deprecate('register("'+type +'", "'+ name+'") is now deprecated in-favour of register("'+type+':'+name+'");', true);
6503
+ Ember.deprecate('register("'+type +'", "'+ name+'") is now deprecated in-favour of register("'+type+':'+name+'");', false);
6258
6504
  fullName = type + ":" + name;
6259
6505
  }
6260
6506
 
@@ -8002,17 +8248,19 @@ Ember.Enumerable = Ember.Mixin.create({
8002
8248
  },
8003
8249
 
8004
8250
  /**
8005
- Returns a copy of the array with all null elements removed.
8251
+ Returns a copy of the array with all null and undefined elements removed.
8006
8252
 
8007
8253
  ```javascript
8008
- var arr = ["a", null, "c", null];
8254
+ var arr = ["a", null, "c", undefined];
8009
8255
  arr.compact(); // ["a", "c"]
8010
8256
  ```
8011
8257
 
8012
8258
  @method compact
8013
- @return {Array} the array without null elements.
8259
+ @return {Array} the array without null and undefined elements.
8014
8260
  */
8015
- compact: function() { return this.without(null); },
8261
+ compact: function() {
8262
+ return this.filter(function(value) { return value != null; });
8263
+ },
8016
8264
 
8017
8265
  /**
8018
8266
  Returns a new enumerable that excludes the passed value. The default
@@ -8067,6 +8315,7 @@ Ember.Enumerable = Ember.Mixin.create({
8067
8315
 
8068
8316
  @property []
8069
8317
  @type Ember.Array
8318
+ @return this
8070
8319
  */
8071
8320
  '[]': Ember.computed(function(key, value) {
8072
8321
  return this;
@@ -8083,6 +8332,7 @@ Ember.Enumerable = Ember.Mixin.create({
8083
8332
  @method addEnumerableObserver
8084
8333
  @param {Object} target
8085
8334
  @param {Hash} [opts]
8335
+ @return this
8086
8336
  */
8087
8337
  addEnumerableObserver: function(target, opts) {
8088
8338
  var willChange = (opts && opts.willChange) || 'enumerableWillChange',
@@ -8102,6 +8352,7 @@ Ember.Enumerable = Ember.Mixin.create({
8102
8352
  @method removeEnumerableObserver
8103
8353
  @param {Object} target
8104
8354
  @param {Hash} [opts]
8355
+ @return this
8105
8356
  */
8106
8357
  removeEnumerableObserver: function(target, opts) {
8107
8358
  var willChange = (opts && opts.willChange) || 'enumerableWillChange',
@@ -8291,6 +8542,7 @@ Ember.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.protot
8291
8542
 
8292
8543
  @method objectAt
8293
8544
  @param {Number} idx The index of the item to return.
8545
+ @return {any} item at index or undefined
8294
8546
  */
8295
8547
  objectAt: function(idx) {
8296
8548
  if ((idx < 0) || (idx>=get(this, 'length'))) return undefined ;
@@ -8308,6 +8560,7 @@ Ember.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.protot
8308
8560
 
8309
8561
  @method objectsAt
8310
8562
  @param {Array} indexes An array of indexes of items to return.
8563
+ @return {Array}
8311
8564
  */
8312
8565
  objectsAt: function(indexes) {
8313
8566
  var self = this;
@@ -8327,6 +8580,7 @@ Ember.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.protot
8327
8580
  This property overrides the default property defined in `Ember.Enumerable`.
8328
8581
 
8329
8582
  @property []
8583
+ @return this
8330
8584
  */
8331
8585
  '[]': Ember.computed(function(key, value) {
8332
8586
  if (value !== undefined) this.replace(0, get(this, 'length'), value) ;
@@ -9044,6 +9298,7 @@ Ember.MutableArray = Ember.Mixin.create(Ember.Array, Ember.MutableEnumerable,
9044
9298
  @method insertAt
9045
9299
  @param {Number} idx index of insert the object at.
9046
9300
  @param {Object} object object to insert
9301
+ @return this
9047
9302
  */
9048
9303
  insertAt: function(idx, object) {
9049
9304
  if (idx > get(this, 'length')) throw new Error(OUT_OF_RANGE_EXCEPTION) ;
@@ -9097,6 +9352,7 @@ Ember.MutableArray = Ember.Mixin.create(Ember.Array, Ember.MutableEnumerable,
9097
9352
 
9098
9353
  @method pushObject
9099
9354
  @param {anything} obj object to push
9355
+ @return {any} the same obj passed as param
9100
9356
  */
9101
9357
  pushObject: function(obj) {
9102
9358
  this.insertAt(get(this, 'length'), obj) ;
@@ -9176,6 +9432,7 @@ Ember.MutableArray = Ember.Mixin.create(Ember.Array, Ember.MutableEnumerable,
9176
9432
 
9177
9433
  @method unshiftObject
9178
9434
  @param {anything} obj object to unshift
9435
+ @return {any} the same obj passed as param
9179
9436
  */
9180
9437
  unshiftObject: function(obj) {
9181
9438
  this.insertAt(0, obj) ;
@@ -9902,6 +10159,7 @@ Ember.Evented = Ember.Mixin.create({
9902
10159
  @param {String} name The name of the event
9903
10160
  @param {Object} [target] The "this" binding for the callback
9904
10161
  @param {Function} method The callback to execute
10162
+ @return this
9905
10163
  */
9906
10164
  on: function(name, target, method) {
9907
10165
  Ember.addListener(this, name, target, method);
@@ -9921,6 +10179,7 @@ Ember.Evented = Ember.Mixin.create({
9921
10179
  @param {String} name The name of the event
9922
10180
  @param {Object} [target] The "this" binding for the callback
9923
10181
  @param {Function} method The callback to execute
10182
+ @return this
9924
10183
  */
9925
10184
  one: function(name, target, method) {
9926
10185
  if (!method) {
@@ -9970,6 +10229,7 @@ Ember.Evented = Ember.Mixin.create({
9970
10229
  @param {String} name The name of the event
9971
10230
  @param {Object} target The target of the subscription
9972
10231
  @param {Function} method The function of the subscription
10232
+ @return this
9973
10233
  */
9974
10234
  off: function(name, target, method) {
9975
10235
  Ember.removeListener(this, name, target, method);
@@ -10326,12 +10586,22 @@ CoreObject.PrototypeMixin = Mixin.create({
10326
10586
  concatenatedProperties: null,
10327
10587
 
10328
10588
  /**
10589
+ Destroyed object property flag.
10590
+
10591
+ if this property is `true` the observers and bindings were already
10592
+ removed by the effect of calling the `destroy()` method.
10593
+
10329
10594
  @property isDestroyed
10330
10595
  @default false
10331
10596
  */
10332
10597
  isDestroyed: false,
10333
10598
 
10334
10599
  /**
10600
+ Destruction scheduled flag. The `destroy()` method has been called.
10601
+
10602
+ The object stays intact until the end of the run loop at which point
10603
+ the `isDestroyed` flag is set.
10604
+
10335
10605
  @property isDestroying
10336
10606
  @default false
10337
10607
  */
@@ -12789,7 +13059,7 @@ Ember Runtime
12789
13059
  */
12790
13060
 
12791
13061
  var jQuery = Ember.imports.jQuery;
12792
- Ember.assert("Ember Views require jQuery 1.8 or 1.9", jQuery && (jQuery().jquery.match(/^1\.(8|9)(\.\d+)?(pre|rc\d?)?/) || Ember.ENV.FORCE_JQUERY));
13062
+ Ember.assert("Ember Views require jQuery 1.8, 1.9 or 2.0", jQuery && (jQuery().jquery.match(/^((1\.(8|9))|2.0)(\.\d+)?(pre|rc\d?)?/) || Ember.ENV.FORCE_JQUERY));
12793
13063
 
12794
13064
  /**
12795
13065
  Alias for jQuery
@@ -12931,9 +13201,11 @@ var setInnerHTML = function(element, html) {
12931
13201
  if (canSetInnerHTML(tagName)) {
12932
13202
  setInnerHTMLWithoutFix(element, html);
12933
13203
  } else {
12934
- Ember.assert("Can't set innerHTML on "+element.tagName+" in this browser", element.outerHTML);
13204
+ // Firefox versions < 11 do not have support for element.outerHTML.
13205
+ var outerHTML = element.outerHTML || new XMLSerializer().serializeToString(element);
13206
+ Ember.assert("Can't set innerHTML on "+element.tagName+" in this browser", outerHTML);
12935
13207
 
12936
- var startTag = element.outerHTML.match(new RegExp("<"+tagName+"([^>]*)>", 'i'))[0],
13208
+ var startTag = outerHTML.match(new RegExp("<"+tagName+"([^>]*)>", 'i'))[0],
12937
13209
  endTag = '</'+tagName+'>';
12938
13210
 
12939
13211
  var wrapper = document.createElement('div');
@@ -13416,7 +13688,9 @@ Ember._RenderBuffer.prototype =
13416
13688
  */
13417
13689
  string: function() {
13418
13690
  if (this._element) {
13419
- return this.element().outerHTML;
13691
+ // Firefox versions < 11 do not have support for element.outerHTML.
13692
+ return this.element().outerHTML ||
13693
+ new XMLSerializer().serializeToString(this.element());
13420
13694
  } else {
13421
13695
  return this.innerString();
13422
13696
  }
@@ -15288,9 +15562,9 @@ Ember.View = Ember.CoreView.extend(
15288
15562
  willInsertElement: Ember.K,
15289
15563
 
15290
15564
  /**
15291
- Called when the element of the view has been inserted into the DOM.
15292
- Override this function to do any set up that requires an element in the
15293
- document body.
15565
+ Called when the element of the view has been inserted into the DOM
15566
+ or after the view was re-rendered. Override this function to do any
15567
+ set up that requires an element in the document body.
15294
15568
 
15295
15569
  @event didInsertElement
15296
15570
  */
@@ -15891,14 +16165,19 @@ Ember.View = Ember.CoreView.extend(
15891
16165
  observer = target;
15892
16166
  target = null;
15893
16167
  }
16168
+
15894
16169
  var view = this,
15895
16170
  stateCheckedObserver = function(){
15896
16171
  view.currentState.invokeObserver(this, observer);
16172
+ },
16173
+ scheduledObserver = function() {
16174
+ Ember.run.scheduleOnce('render', this, stateCheckedObserver);
15897
16175
  };
15898
- Ember.addObserver(root, path, target, stateCheckedObserver);
16176
+
16177
+ Ember.addObserver(root, path, target, scheduledObserver);
15899
16178
 
15900
16179
  this.one('willClearRender', function() {
15901
- Ember.removeObserver(root, path, target, stateCheckedObserver);
16180
+ Ember.removeObserver(root, path, target, scheduledObserver);
15902
16181
  });
15903
16182
  }
15904
16183
 
@@ -18976,7 +19255,7 @@ if(!Handlebars && typeof require === 'function') {
18976
19255
  Handlebars = require('handlebars');
18977
19256
  }
18978
19257
 
18979
- Ember.assert("Ember Handlebars requires Handlebars 1.0.0-rc.3 or greater", Handlebars && Handlebars.VERSION.match(/^1\.0\.[0-9](\.rc\.[23456789]+)?/));
19258
+ Ember.assert("Ember Handlebars requires Handlebars 1.0.0-rc.3 or greater. Include a SCRIPT tag in the HTML HEAD linking to the Handlebars file before you link to Ember.", Handlebars && Handlebars.COMPILER_REVISION === 2);
18980
19259
 
18981
19260
  /**
18982
19261
  Prepares the Handlebars templating library for use inside Ember's view
@@ -19447,10 +19726,10 @@ Ember.Handlebars.registerBoundHelper = function(name, fn) {
19447
19726
 
19448
19727
  view.appendChild(bindView);
19449
19728
 
19450
- view.registerObserver(pathRoot, path, bindView, rerenderBoundHelperView);
19729
+ view.registerObserver(pathRoot, path, bindView, bindView.rerender);
19451
19730
 
19452
19731
  for (var i=0, l=dependentKeys.length; i<l; i++) {
19453
- view.registerObserver(pathRoot, path + '.' + dependentKeys[i], bindView, rerenderBoundHelperView);
19732
+ view.registerObserver(pathRoot, path + '.' + dependentKeys[i], bindView, bindView.rerender);
19454
19733
  }
19455
19734
  }
19456
19735
 
@@ -19514,22 +19793,11 @@ function evaluateMultiPropertyBoundHelper(context, fn, normalizedProperties, opt
19514
19793
  // Observe each property.
19515
19794
  for (loc = 0, len = watchedProperties.length; loc < len; ++loc) {
19516
19795
  property = watchedProperties[loc];
19517
- view.registerObserver(property.root, property.path, bindView, rerenderBoundHelperView);
19796
+ view.registerObserver(property.root, property.path, bindView, bindView.rerender);
19518
19797
  }
19519
19798
 
19520
19799
  }
19521
19800
 
19522
- /**
19523
- @private
19524
-
19525
- An observer function used with bound helpers which
19526
- will schedule a re-render of the _SimpleHandlebarsView
19527
- connected with the helper.
19528
- */
19529
- function rerenderBoundHelperView() {
19530
- Ember.run.scheduleOnce('render', this, 'rerender');
19531
- }
19532
-
19533
19801
  /**
19534
19802
  @private
19535
19803
 
@@ -20572,17 +20840,13 @@ EmberHandlebars.registerHelper('bindAttr', function(options) {
20572
20840
  Ember.View.applyAttributeBindings(elem, attr, result);
20573
20841
  };
20574
20842
 
20575
- invoker = function() {
20576
- Ember.run.scheduleOnce('render', observer);
20577
- };
20578
-
20579
20843
  // Add an observer to the view for when the property changes.
20580
20844
  // When the observer fires, find the element using the
20581
20845
  // unique data id and update the attribute to the new value.
20582
20846
  // Note: don't add observer when path is 'this' or path
20583
20847
  // is whole keyword e.g. {{#each x in list}} ... {{bindAttr attr="x"}}
20584
20848
  if (path !== 'this' && !(normalized.isKeyword && normalized.path === '' )) {
20585
- view.registerObserver(normalized.root, normalized.path, invoker);
20849
+ view.registerObserver(normalized.root, normalized.path, observer);
20586
20850
  }
20587
20851
 
20588
20852
  // if this changes, also change the logic in ember-views/lib/views/view.js
@@ -20696,12 +20960,8 @@ EmberHandlebars.bindClasses = function(context, classBindings, view, bindAttrId,
20696
20960
  }
20697
20961
  };
20698
20962
 
20699
- invoker = function() {
20700
- Ember.run.scheduleOnce('render', observer);
20701
- };
20702
-
20703
20963
  if (path !== '' && path !== 'this') {
20704
- view.registerObserver(pathRoot, path, invoker);
20964
+ view.registerObserver(pathRoot, path, observer);
20705
20965
  }
20706
20966
 
20707
20967
  // We've already setup the observer; now we just need to figure out the
@@ -21752,11 +22012,12 @@ Ember.Handlebars.registerHelper('each', function(path, options) {
21752
22012
  */
21753
22013
 
21754
22014
  Ember.Handlebars.registerHelper('template', function(name, options) {
21755
- var template = Ember.TEMPLATES[name];
22015
+ var view = options.data.view,
22016
+ template = view.templateForName(name);
21756
22017
 
21757
22018
  Ember.assert("Unable to find template with name '"+name+"'.", !!template);
21758
22019
 
21759
- Ember.TEMPLATES[name](this, { data: options.data });
22020
+ template(this, { data: options.data });
21760
22021
  });
21761
22022
 
21762
22023
  })();
@@ -21771,7 +22032,7 @@ Ember.Handlebars.registerHelper('template', function(name, options) {
21771
22032
 
21772
22033
  /**
21773
22034
  `partial` renders a template directly using the current context.
21774
- If needed the context can be set using the `{{#with foo}}` helper.
22035
+ If needed the context can be set using the `{{#with foo}}` helper.
21775
22036
 
21776
22037
  ```html
21777
22038
  <script type="text/x-handlebars" data-template-name="header_bar">
@@ -21800,10 +22061,10 @@ Ember.Handlebars.registerHelper('partial', function(name, options) {
21800
22061
 
21801
22062
  nameParts[nameParts.length - 1] = "_" + lastPart;
21802
22063
 
21803
- var underscoredName = nameParts.join("/");
21804
-
21805
- var template = Ember.TEMPLATES[underscoredName],
21806
- deprecatedTemplate = Ember.TEMPLATES[name];
22064
+ var view = options.data.view,
22065
+ underscoredName = nameParts.join("/"),
22066
+ template = view.templateForName(underscoredName),
22067
+ deprecatedTemplate = view.templateForName(name);
21807
22068
 
21808
22069
  Ember.deprecate("You tried to render the partial " + name + ", which should be at '" + underscoredName + "', but Ember found '" + name + "'. Please use a leading underscore in your partials", template);
21809
22070
  Ember.assert("Unable to find partial with name '"+name+"'.", template || deprecatedTemplate);
@@ -21957,7 +22218,7 @@ Ember.Checkbox = Ember.View.extend({
21957
22218
 
21958
22219
  tagName: 'input',
21959
22220
 
21960
- attributeBindings: ['type', 'checked', 'disabled', 'tabindex'],
22221
+ attributeBindings: ['type', 'checked', 'disabled', 'tabindex', 'name'],
21961
22222
 
21962
22223
  type: "checkbox",
21963
22224
  checked: false,
@@ -22089,7 +22350,7 @@ Ember.TextField = Ember.View.extend(Ember.TextSupport,
22089
22350
 
22090
22351
  classNames: ['ember-text-field'],
22091
22352
  tagName: "input",
22092
- attributeBindings: ['type', 'value', 'size', 'pattern'],
22353
+ attributeBindings: ['type', 'value', 'size', 'pattern', 'name'],
22093
22354
 
22094
22355
  /**
22095
22356
  The `value` attribute of the input element. As the user inputs text, this
@@ -22349,7 +22610,7 @@ Ember.TextArea = Ember.View.extend(Ember.TextSupport, {
22349
22610
  classNames: ['ember-text-area'],
22350
22611
 
22351
22612
  tagName: "textarea",
22352
- attributeBindings: ['rows', 'cols'],
22613
+ attributeBindings: ['rows', 'cols', 'name'],
22353
22614
  rows: null,
22354
22615
  cols: null,
22355
22616
 
@@ -22674,7 +22935,7 @@ function program3(depth0,data) {
22674
22935
  return buffer;
22675
22936
 
22676
22937
  }),
22677
- attributeBindings: ['multiple', 'disabled', 'tabindex'],
22938
+ attributeBindings: ['multiple', 'disabled', 'tabindex', 'name'],
22678
22939
 
22679
22940
  /**
22680
22941
  The `multiple` attribute of the select element. Indicates whether multiple