ember-source 4.6.0-alpha.1 → 4.6.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-metadata.json +3 -3
- package/dist/ember-template-compiler.js +2 -2
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +3 -8
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +119 -419
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/glimmer/index.js +21 -11
- package/dist/packages/@ember/-internals/metal/index.js +0 -3
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +0 -4
- package/dist/packages/@ember/controller/lib/controller_mixin.js +8 -18
- package/dist/packages/@ember/object/lib/computed/computed_macros.js +6 -4
- package/dist/packages/@ember/object/lib/computed/reduce_computed_macros.js +73 -364
- package/dist/packages/ember/version.js +1 -1
- package/dist/packages/ember-testing/lib/adapters/adapter.js +2 -7
- package/docs/data.json +533 -527
- package/package.json +4 -4
package/dist/header/license.js
CHANGED
|
@@ -2957,14 +2957,25 @@ function escapeExpression(string) {
|
|
|
2957
2957
|
return string.replace(badChars, escapeChar);
|
|
2958
2958
|
}
|
|
2959
2959
|
/**
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2960
|
+
Use this method to indicate that a string should be rendered as HTML
|
|
2961
|
+
when the string is used in a template. To say this another way,
|
|
2962
|
+
strings marked with `htmlSafe` will not be HTML escaped.
|
|
2963
|
+
|
|
2964
|
+
A word of warning - The `htmlSafe` method does not make the string safe;
|
|
2965
|
+
it only tells the framework to treat the string as if it is safe to render
|
|
2966
|
+
as HTML. If a string contains user inputs or other untrusted
|
|
2967
|
+
data, you must sanitize the string before using the `htmlSafe` method.
|
|
2968
|
+
Otherwise your code is vulnerable to
|
|
2969
|
+
[Cross-Site Scripting](https://owasp.org/www-community/attacks/DOM_Based_XSS).
|
|
2970
|
+
There are many open source sanitization libraries to choose from,
|
|
2971
|
+
both for front end and server-side sanitization.
|
|
2963
2972
|
|
|
2964
2973
|
```javascript
|
|
2965
2974
|
import { htmlSafe } from '@ember/template';
|
|
2966
2975
|
|
|
2967
|
-
|
|
2976
|
+
const someTrustedOrSanitizedString = "<div>Hello!</div>"
|
|
2977
|
+
|
|
2978
|
+
htmlSafe(someTrustedorSanitizedString)
|
|
2968
2979
|
```
|
|
2969
2980
|
|
|
2970
2981
|
@method htmlSafe
|
|
@@ -5166,10 +5177,13 @@ class DynamicScope {
|
|
|
5166
5177
|
return value;
|
|
5167
5178
|
}
|
|
5168
5179
|
|
|
5169
|
-
}
|
|
5180
|
+
}
|
|
5181
|
+
|
|
5182
|
+
const NO_OP = () => {}; // This wrapper logic prevents us from rerendering in case of a hard failure
|
|
5170
5183
|
// during render. This prevents infinite revalidation type loops from occuring,
|
|
5171
5184
|
// and ensures that errors are not swallowed by subsequent follow on failures.
|
|
5172
5185
|
|
|
5186
|
+
|
|
5173
5187
|
function errorLoopTransaction(fn$$1) {
|
|
5174
5188
|
if (DEBUG) {
|
|
5175
5189
|
return () => {
|
|
@@ -5270,10 +5284,6 @@ function loopBegin() {
|
|
|
5270
5284
|
}
|
|
5271
5285
|
}
|
|
5272
5286
|
|
|
5273
|
-
function K() {
|
|
5274
|
-
/* noop */
|
|
5275
|
-
}
|
|
5276
|
-
|
|
5277
5287
|
let renderSettledDeferred = null;
|
|
5278
5288
|
/*
|
|
5279
5289
|
Returns a promise which will resolve when rendering has settled. Settled in
|
|
@@ -5292,7 +5302,7 @@ function renderSettled() {
|
|
|
5292
5302
|
|
|
5293
5303
|
if (!_getCurrentRunLoop()) {
|
|
5294
5304
|
// ensure a runloop has been kicked off
|
|
5295
|
-
_backburner.schedule('actions', null,
|
|
5305
|
+
_backburner.schedule('actions', null, NO_OP);
|
|
5296
5306
|
}
|
|
5297
5307
|
}
|
|
5298
5308
|
|
|
@@ -5321,7 +5331,7 @@ function loopEnd() {
|
|
|
5321
5331
|
}
|
|
5322
5332
|
|
|
5323
5333
|
loops++;
|
|
5324
|
-
return _backburner.join(null,
|
|
5334
|
+
return _backburner.join(null, NO_OP);
|
|
5325
5335
|
}
|
|
5326
5336
|
}
|
|
5327
5337
|
|
|
@@ -14,9 +14,6 @@ import VERSION from 'ember/version';
|
|
|
14
14
|
import { INIT_FACTORY } from '@ember/-internals/container';
|
|
15
15
|
import { getOwner } from '@ember/-internals/owner';
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
@module @ember/object
|
|
19
|
-
*/
|
|
20
17
|
/*
|
|
21
18
|
The event system uses a series of nested hashes to store listeners on an
|
|
22
19
|
object. When a listener is registered, or when an event arrives, these
|
|
@@ -12,10 +12,6 @@ import { calculateCacheKey, extractRouteArgs, getActiveTargetName, resemblesURL
|
|
|
12
12
|
import DSL from './dsl';
|
|
13
13
|
import { defaultSerialize, getFullQueryParams, hasDefaultSerialize, ROUTE_CONNECTIONS } from './route';
|
|
14
14
|
import RouterState from './router_state';
|
|
15
|
-
/**
|
|
16
|
-
@module @ember/routing
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
15
|
import Router, { logAbort, STATE_SYMBOL } from 'router_js';
|
|
20
16
|
import EngineInstance from '@ember/engine/instance';
|
|
21
17
|
|
|
@@ -2,31 +2,20 @@ import { Mixin, computed } from '@ember/-internals/metal';
|
|
|
2
2
|
import { ActionHandler } from '@ember/-internals/runtime';
|
|
3
3
|
import { symbol } from '@ember/-internals/utils';
|
|
4
4
|
const MODEL = symbol('MODEL');
|
|
5
|
-
|
|
6
|
-
@module ember
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
@class ControllerMixin
|
|
11
|
-
@namespace Ember
|
|
12
|
-
@uses Ember.ActionHandler
|
|
13
|
-
@private
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
export default Mixin.create(ActionHandler, {
|
|
5
|
+
const ControllerMixin = Mixin.create(ActionHandler, {
|
|
17
6
|
/* ducktype as a controller */
|
|
18
7
|
isController: true,
|
|
19
8
|
|
|
20
9
|
/**
|
|
21
10
|
The object to which actions from the view should be sent.
|
|
22
|
-
|
|
11
|
+
For example, when a Handlebars template uses the `{{action}}` helper,
|
|
23
12
|
it will attempt to send the action to the view's controller's `target`.
|
|
24
|
-
|
|
13
|
+
By default, the value of the target property is set to the router, and
|
|
25
14
|
is injected when a controller is instantiated. This injection is applied
|
|
26
15
|
as part of the application's initialization process. In most cases the
|
|
27
16
|
`target` property will automatically be set to the logical consumer of
|
|
28
17
|
actions for the controller.
|
|
29
|
-
|
|
18
|
+
@property target
|
|
30
19
|
@default null
|
|
31
20
|
@public
|
|
32
21
|
*/
|
|
@@ -36,7 +25,7 @@ export default Mixin.create(ActionHandler, {
|
|
|
36
25
|
/**
|
|
37
26
|
The controller's current model. When retrieving or modifying a controller's
|
|
38
27
|
model, this property should be used instead of the `content` property.
|
|
39
|
-
|
|
28
|
+
@property model
|
|
40
29
|
@public
|
|
41
30
|
*/
|
|
42
31
|
model: computed({
|
|
@@ -44,9 +33,10 @@ export default Mixin.create(ActionHandler, {
|
|
|
44
33
|
return this[MODEL];
|
|
45
34
|
},
|
|
46
35
|
|
|
47
|
-
set(
|
|
36
|
+
set(_key, value) {
|
|
48
37
|
return this[MODEL] = value;
|
|
49
38
|
}
|
|
50
39
|
|
|
51
40
|
})
|
|
52
|
-
});
|
|
41
|
+
});
|
|
42
|
+
export default ControllerMixin;
|
|
@@ -11,8 +11,7 @@ function expandPropertiesToArray(predicateName, properties) {
|
|
|
11
11
|
expandedProperties.push(entry);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
for (let
|
|
15
|
-
let property = properties[i];
|
|
14
|
+
for (let property of properties) {
|
|
16
15
|
assert(`Dependent keys passed to \`${predicateName}\` computed macro can't have spaces.`, property.indexOf(' ') < 0);
|
|
17
16
|
expandProperties(property, extractProperty);
|
|
18
17
|
}
|
|
@@ -21,19 +20,22 @@ function expandPropertiesToArray(predicateName, properties) {
|
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
function generateComputedWithPredicate(name, predicate) {
|
|
24
|
-
return (...
|
|
23
|
+
return (dependentKey, ...additionalDependentKeys) => {
|
|
24
|
+
let properties = [dependentKey, ...additionalDependentKeys];
|
|
25
25
|
assert(`You attempted to use @${name} as a decorator directly, but it requires at least one dependent key parameter`, !isElementDescriptor(properties));
|
|
26
26
|
let dependentKeys = expandPropertiesToArray(name, properties);
|
|
27
27
|
let computedFunc = computed(...dependentKeys, function () {
|
|
28
28
|
let lastIdx = dependentKeys.length - 1;
|
|
29
29
|
|
|
30
30
|
for (let i = 0; i < lastIdx; i++) {
|
|
31
|
+
// SAFETY: `i` is derived from the length of `dependentKeys`
|
|
31
32
|
let value = get(this, dependentKeys[i]);
|
|
32
33
|
|
|
33
34
|
if (!predicate(value)) {
|
|
34
35
|
return value;
|
|
35
36
|
}
|
|
36
|
-
}
|
|
37
|
+
} // SAFETY: `lastIdx` is derived from the length of `dependentKeys`
|
|
38
|
+
|
|
37
39
|
|
|
38
40
|
return get(this, dependentKeys[lastIdx]);
|
|
39
41
|
});
|