Skip to content

Commit b962cd8

Browse files
committed
1.0.20
1 parent 199af8d commit b962cd8

File tree

4 files changed

+74
-49
lines changed

4 files changed

+74
-49
lines changed

src/guide/installation.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
title: Installation
33
type: guide
44
order: 0
5-
vue_version: 1.0.19
6-
dev_size: "258.16"
7-
min_size: "72.85"
8-
gz_size: "25.09"
5+
vue_version: 1.0.20
6+
dev_size: "258.56"
7+
min_size: "72.92"
8+
gz_size: "25.10"
99
---
1010

1111
> **Compatibility Note:** Vue.js does not support IE8 and below.

themes/vue/_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
google_analytics: UA-46852172-1
22
root_domain: vuejs.org
3-
vue_version: 1.0.19
3+
vue_version: 1.0.20

themes/vue/source/js/vue.js

Lines changed: 65 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Vue.js v1.0.19
2+
* Vue.js v1.0.20
33
* (c) 2016 Evan You
44
* Released under the MIT License.
55
*/
@@ -2046,6 +2046,24 @@ var transition = Object.freeze({
20462046

20472047
var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
20482048

2049+
/**
2050+
* By default, when a reactive property is set, the new value is
2051+
* also converted to become reactive. However in certain cases, e.g.
2052+
* v-for scope alias and props, we don't want to force conversion
2053+
* because the value may be a nested value under a frozen data structure.
2054+
*
2055+
* So whenever we want to set a reactive property without forcing
2056+
* conversion on the new value, we wrap that call inside this function.
2057+
*/
2058+
2059+
var shouldConvert = true;
2060+
2061+
function withoutConversion(fn) {
2062+
shouldConvert = false;
2063+
fn();
2064+
shouldConvert = true;
2065+
}
2066+
20492067
/**
20502068
* Observer class that are attached to each observed
20512069
* object. Once attached, the observer converts target
@@ -2183,7 +2201,7 @@ var transition = Object.freeze({
21832201
var ob;
21842202
if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
21852203
ob = value.__ob__;
2186-
} else if ((isArray(value) || isPlainObject(value)) && Object.isExtensible(value) && !value._isVue) {
2204+
} else if (shouldConvert && (isArray(value) || isPlainObject(value)) && Object.isExtensible(value) && !value._isVue) {
21872205
ob = new Observer(value);
21882206
}
21892207
if (ob && vm) {
@@ -2198,10 +2216,9 @@ var transition = Object.freeze({
21982216
* @param {Object} obj
21992217
* @param {String} key
22002218
* @param {*} val
2201-
* @param {Boolean} doNotObserve
22022219
*/
22032220

2204-
function defineReactive(obj, key, val, doNotObserve) {
2221+
function defineReactive(obj, key, val) {
22052222
var dep = new Dep();
22062223

22072224
var property = Object.getOwnPropertyDescriptor(obj, key);
@@ -2213,11 +2230,7 @@ var transition = Object.freeze({
22132230
var getter = property && property.get;
22142231
var setter = property && property.set;
22152232

2216-
// if doNotObserve is true, only use the child value observer
2217-
// if it already exists, and do not attempt to create it.
2218-
// this allows freezing a large object from the root and
2219-
// avoid unnecessary observation inside v-for fragments.
2220-
var childOb = doNotObserve ? isObject(val) && val.__ob__ : observe(val);
2233+
var childOb = observe(val);
22212234
Object.defineProperty(obj, key, {
22222235
enumerable: true,
22232236
configurable: true,
@@ -2247,7 +2260,7 @@ var transition = Object.freeze({
22472260
} else {
22482261
val = newVal;
22492262
}
2250-
childOb = doNotObserve ? isObject(newVal) && newVal.__ob__ : observe(newVal);
2263+
childOb = observe(newVal);
22512264
dep.notify();
22522265
}
22532266
});
@@ -4021,7 +4034,9 @@ var template = Object.freeze({
40214034
// update data for track-by, object repeat &
40224035
// primitive values.
40234036
if (trackByKey || convertedFromObject || primitive) {
4024-
frag.scope[alias] = value;
4037+
withoutConversion(function () {
4038+
frag.scope[alias] = value;
4039+
});
40254040
}
40264041
} else {
40274042
// new isntance
@@ -4111,7 +4126,11 @@ var template = Object.freeze({
41114126
// for two-way binding on alias
41124127
scope.$forContext = this;
41134128
// define scope properties
4114-
defineReactive(scope, alias, value, true /* do not observe */);
4129+
// important: define the scope alias without forced conversion
4130+
// so that frozen data structures remain non-reactive.
4131+
withoutConversion(function () {
4132+
defineReactive(scope, alias, value);
4133+
});
41154134
defineReactive(scope, '$index', index);
41164135
if (key) {
41174136
defineReactive(scope, '$key', key);
@@ -5709,7 +5728,9 @@ var template = Object.freeze({
57095728

57105729
unbuild: function unbuild(defer) {
57115730
if (this.waitingFor) {
5712-
this.waitingFor.$destroy();
5731+
if (!this.keepAlive) {
5732+
this.waitingFor.$destroy();
5733+
}
57135734
this.waitingFor = null;
57145735
}
57155736
var child = this.childVM;
@@ -6003,15 +6024,7 @@ var template = Object.freeze({
60036024
value = getPropDefaultValue(vm, prop.options);
60046025
}
60056026
if (assertProp(prop, value)) {
6006-
var doNotObserve =
6007-
// if the passed down prop was already converted, then
6008-
// subsequent sets should also be converted, because the user
6009-
// may mutate the prop binding in the child component (#2549)
6010-
!(value && value.__ob__) && (
6011-
// otherwise we can skip observation for props that are either
6012-
// literal or points to a simple path (non-derived values)
6013-
!prop.dynamic || isSimplePath(prop.raw));
6014-
defineReactive(vm, key, value, doNotObserve);
6027+
defineReactive(vm, key, value);
60156028
}
60166029
}
60176030

@@ -6130,11 +6143,18 @@ var template = Object.freeze({
61306143
var childKey = prop.path;
61316144
var parentKey = prop.parentPath;
61326145
var twoWay = prop.mode === bindingModes.TWO_WAY;
6146+
var isSimple = isSimplePath(parentKey);
61336147

61346148
var parentWatcher = this.parentWatcher = new Watcher(parent, parentKey, function (val) {
61356149
val = coerceProp(prop, val);
61366150
if (assertProp(prop, val)) {
6137-
child[childKey] = val;
6151+
if (isSimple) {
6152+
withoutConversion(function () {
6153+
child[childKey] = val;
6154+
});
6155+
} else {
6156+
child[childKey] = val;
6157+
}
61386158
}
61396159
}, {
61406160
twoWay: twoWay,
@@ -6145,7 +6165,14 @@ var template = Object.freeze({
61456165
});
61466166

61476167
// set the child initial value.
6148-
initProp(child, prop, parentWatcher.value);
6168+
var value = parentWatcher.value;
6169+
if (isSimple && value !== undefined) {
6170+
withoutConversion(function () {
6171+
initProp(child, prop, value);
6172+
});
6173+
} else {
6174+
initProp(child, prop, value);
6175+
}
61496176

61506177
// setup two-way binding
61516178
if (twoWay) {
@@ -7143,15 +7170,17 @@ var template = Object.freeze({
71437170
}
71447171
}
71457172

7146-
var attr, name, value, matched, dirName, arg, def, termDef;
7173+
var attr, name, value, modifiers, matched, dirName, rawName, arg, def, termDef;
71477174
for (var i = 0, j = attrs.length; i < j; i++) {
71487175
attr = attrs[i];
7149-
if (matched = attr.name.match(dirAttrRE)) {
7176+
modifiers = parseModifiers(attr.name);
7177+
name = attr.name.replace(modifierRE, '');
7178+
if (matched = name.match(dirAttrRE)) {
71507179
def = resolveAsset(options, 'directives', matched[1]);
71517180
if (def && def.terminal) {
71527181
if (!termDef || (def.priority || DEFAULT_TERMINAL_PRIORITY) > termDef.priority) {
71537182
termDef = def;
7154-
name = attr.name;
7183+
rawName = attr.name;
71557184
value = attr.value;
71567185
dirName = matched[1];
71577186
arg = matched[2];
@@ -7161,7 +7190,7 @@ var template = Object.freeze({
71617190
}
71627191

71637192
if (termDef) {
7164-
return makeTerminalNodeLinkFn(el, dirName, value, options, termDef, name, arg);
7193+
return makeTerminalNodeLinkFn(el, dirName, value, options, termDef, rawName, arg, modifiers);
71657194
}
71667195
}
71677196

@@ -7179,28 +7208,24 @@ var template = Object.freeze({
71797208
* @param {String} value
71807209
* @param {Object} options
71817210
* @param {Object} def
7182-
* @param {String} [attrName]
7211+
* @param {String} [rawName]
71837212
* @param {String} [arg]
7213+
* @param {Object} [modifiers]
71847214
* @return {Function} terminalLinkFn
71857215
*/
71867216

7187-
function makeTerminalNodeLinkFn(el, dirName, value, options, def, attrName, arg) {
7217+
function makeTerminalNodeLinkFn(el, dirName, value, options, def, rawName, arg, modifiers) {
71887218
var parsed = parseDirective(value);
71897219
var descriptor = {
71907220
name: dirName,
7221+
arg: arg,
71917222
expression: parsed.expression,
71927223
filters: parsed.filters,
71937224
raw: value,
7194-
rawName: attrName,
7225+
attr: rawName,
7226+
modifiers: modifiers,
71957227
def: def
71967228
};
7197-
if (attrName) {
7198-
descriptor.rawName = attrName;
7199-
descriptor.modifiers = parseModifiers(attrName);
7200-
}
7201-
if (arg) {
7202-
descriptor.arg = arg.replace(modifierRE, '');
7203-
}
72047229
// check ref for v-for and router-view
72057230
if (dirName === 'for' || dirName === 'router-view') {
72067231
descriptor.ref = findRef(el);
@@ -8130,7 +8155,7 @@ var template = Object.freeze({
81308155
var i = params.length;
81318156
var key, val, mappedKey;
81328157
while (i--) {
8133-
key = params[i];
8158+
key = hyphenate(params[i]);
81348159
mappedKey = camelize(key);
81358160
val = getBindAttr(this.el, key);
81368161
if (val != null) {
@@ -9778,7 +9803,7 @@ var template = Object.freeze({
97789803

97799804
installGlobalAPI(Vue);
97809805

9781-
Vue.version = '1.0.19';
9806+
Vue.version = '1.0.20';
97829807

97839808
// devtools global hook
97849809
/* istanbul ignore next */

themes/vue/source/js/vue.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)