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.
- data/dist/ember-data-deps.js +314 -44
- data/dist/ember-data-deps.min.js +5 -5
- data/dist/ember-data-deps.prod.js +308 -39
- data/dist/ember-debug.js +3 -2
- data/dist/ember-old-router.js +350 -89
- data/dist/ember-old-router.min.js +8 -8
- data/dist/ember-old-router.prod.js +341 -81
- data/dist/ember-runtime.js +314 -44
- data/dist/ember-runtime.min.js +5 -5
- data/dist/ember-runtime.prod.js +308 -39
- data/dist/ember-spade.js +1 -1
- data/dist/ember-template-compiler.js +3 -3
- data/dist/ember-template-compiler.min.js +2 -2
- data/dist/ember-tests.js +1 -1
- data/dist/ember.js +431 -136
- data/dist/ember.min.js +8 -8
- data/dist/ember.prod.js +419 -125
- metadata +2 -2
data/dist/ember-runtime.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
// Version: v1.0.0-rc.1-
|
2
|
-
// Last commit:
|
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-
|
154
|
-
// Last commit:
|
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.
|
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.
|
242
|
+
@default '1.0.0-rc.2'
|
242
243
|
@final
|
243
244
|
*/
|
244
|
-
Ember.VERSION = '1.0.0-rc.
|
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 {
|
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.
|
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
|
-
|
3682
|
-
return Ember.
|
3683
|
-
|
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
|
-
|
3693
|
-
return Ember.
|
3694
|
-
|
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.
|
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
|
-
|
3705
|
-
return
|
3706
|
-
|
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
|
-
|
3717
|
-
return
|
3718
|
-
|
3719
|
-
});
|
3720
|
-
};
|
3762
|
+
registerComputed('bool', function(dependentKey) {
|
3763
|
+
return !!get(this, dependentKey);
|
3764
|
+
});
|
3721
3765
|
|
3722
3766
|
/**
|
3723
|
-
@method computed.
|
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
|
3724
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
|
+
});
|
3725
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
|
3726
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
|
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
|
+
});
|
3907
|
+
|
3908
|
+
/**
|
3909
|
+
@method computed.alias
|
3910
|
+
@for Ember
|
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
|
4695
|
-
|
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
|
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+'");',
|
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",
|
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() {
|
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
|
*/
|