Skip to content

Commit a58b4c1

Browse files
committed
[build] 1.0.12
1 parent e56778a commit a58b4c1

File tree

3 files changed

+70
-36
lines changed

3 files changed

+70
-36
lines changed

dist/vue.js

+65-31
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Vue.js v1.0.11
2+
* Vue.js v1.0.12
33
* (c) 2015 Evan You
44
* Released under the MIT License.
55
*/
@@ -1253,7 +1253,7 @@
12531253

12541254
function setClass(el, cls) {
12551255
/* istanbul ignore if */
1256-
if (isIE9 && el.hasOwnProperty('className')) {
1256+
if (isIE9 && !(el instanceof SVGElement)) {
12571257
el.className = cls;
12581258
} else {
12591259
el.setAttribute('class', cls);
@@ -1454,6 +1454,7 @@
14541454
}
14551455

14561456
var commonTagRE = /^(div|p|span|img|a|b|i|br|ul|ol|li|h1|h2|h3|h4|h5|h6|code|pre|table|th|td|tr|form|label|input|select|option|nav|article|section|header|footer)$/;
1457+
var reservedTagRE = /^(slot|partial|component)$/;
14571458

14581459
/**
14591460
* Check if an element is a component, if yes return its
@@ -1467,7 +1468,7 @@
14671468
function checkComponentAttr(el, options) {
14681469
var tag = el.tagName.toLowerCase();
14691470
var hasAttrs = el.hasAttributes();
1470-
if (!commonTagRE.test(tag) && tag !== 'component') {
1471+
if (!commonTagRE.test(tag) && !reservedTagRE.test(tag)) {
14711472
if (resolveAsset(options, 'components', tag)) {
14721473
return { id: tag };
14731474
} else {
@@ -1518,6 +1519,7 @@
15181519

15191520
function initProp(vm, prop, value) {
15201521
var key = prop.path;
1522+
value = coerceProp(prop, value);
15211523
vm[key] = vm._data[key] = assertProp(prop, value) ? value : undefined;
15221524
}
15231525

@@ -1575,6 +1577,23 @@
15751577
return true;
15761578
}
15771579

1580+
/**
1581+
* Force parsing value with coerce option.
1582+
*
1583+
* @param {*} value
1584+
* @param {Object} options
1585+
* @return {*}
1586+
*/
1587+
1588+
function coerceProp(prop, value) {
1589+
var coerce = prop.options.coerce;
1590+
if (!coerce) {
1591+
return value;
1592+
}
1593+
// coerce is a function
1594+
return coerce(value);
1595+
}
1596+
15781597
function formatType(val) {
15791598
return val ? val.charAt(0).toUpperCase() + val.slice(1) : 'custom type';
15801599
}
@@ -1760,8 +1779,8 @@
17601779
var ids = Object.keys(components);
17611780
for (var i = 0, l = ids.length; i < l; i++) {
17621781
var key = ids[i];
1763-
if (commonTagRE.test(key)) {
1764-
'development' !== 'production' && warn('Do not use built-in HTML elements as component ' + 'id: ' + key);
1782+
if (commonTagRE.test(key) || reservedTagRE.test(key)) {
1783+
'development' !== 'production' && warn('Do not use built-in or reserved HTML elements as component ' + 'id: ' + key);
17651784
continue;
17661785
}
17671786
def = components[key];
@@ -2281,6 +2300,7 @@
22812300
replace: replace,
22822301
on: on$1,
22832302
off: off,
2303+
setClass: setClass,
22842304
addClass: addClass,
22852305
removeClass: removeClass,
22862306
extractContent: extractContent,
@@ -2296,7 +2316,9 @@
22962316
checkComponentAttr: checkComponentAttr,
22972317
initProp: initProp,
22982318
assertProp: assertProp,
2319+
coerceProp: coerceProp,
22992320
commonTagRE: commonTagRE,
2321+
reservedTagRE: reservedTagRE,
23002322
get warn () { return warn; }
23012323
});
23022324

@@ -3224,11 +3246,11 @@
32243246
if (this.active) {
32253247
var value = this.get();
32263248
if (value !== this.value ||
3227-
// Deep watchers and Array watchers should fire even
3249+
// Deep watchers and watchers on Object/Arrays should fire even
32283250
// when the value is the same, because the value may
32293251
// have mutated; but only do so if this is a
32303252
// non-shallow update (caused by a vm digest).
3231-
(isArray(value) || this.deep) && !this.shallow) {
3253+
(isObject(value) || this.deep) && !this.shallow) {
32323254
// set new value
32333255
var oldValue = this.value;
32343256
this.value = value;
@@ -3474,13 +3496,12 @@
34743496
var xlinkNS = 'http://www.w3.org/1999/xlink';
34753497
var xlinkRE = /^xlink:/;
34763498

3477-
// these input element attributes should also set their
3478-
// corresponding properties
3479-
var inputProps = {
3480-
value: 1,
3481-
checked: 1,
3482-
selected: 1
3483-
};
3499+
// check for attributes that prohibit interpolations
3500+
var disallowedInterpAttrRE = /^v-|^:|^@|^(is|transition|transition-mode|debounce|track-by|stagger|enter-stagger|leave-stagger)$/;
3501+
3502+
// these attributes should also set their corresponding properties
3503+
// because they only affect the initial state of the element
3504+
var attrWithPropsRE = /^(value|checked|selected|muted)$/;
34843505

34853506
// these attributes should set a hidden property for
34863507
// binding v-model to object values
@@ -3490,9 +3511,6 @@
34903511
'false-value': '_falseValue'
34913512
};
34923513

3493-
// check for attributes that prohibit interpolations
3494-
var disallowedInterpAttrRE = /^v-|^:|^@|^(is|transition|transition-mode|debounce|track-by|stagger|enter-stagger|leave-stagger)$/;
3495-
34963514
var bind = {
34973515

34983516
priority: 850,
@@ -3545,9 +3563,9 @@
35453563
handleObject: style.handleObject,
35463564

35473565
handleSingle: function handleSingle(attr, value) {
3548-
if (inputProps[attr] && attr in this.el) {
3549-
this.el[attr] = attr === 'value' ? value || '' : // IE9 will set input.value to "null" for null...
3550-
value;
3566+
if (!this.descriptor.interp && attrWithPropsRE.test(attr) && attr in this.el) {
3567+
this.el[attr] = attr === 'value' ? value == null // IE9 will set input.value to "null" for null...
3568+
? '' : value : value;
35513569
}
35523570
// set model props
35533571
var modelProp = modelProps[attr];
@@ -3928,13 +3946,18 @@
39283946
});
39293947
this.on('blur', function () {
39303948
self.focused = false;
3931-
self.listener();
3949+
// do not sync value after fragment removal (#2017)
3950+
if (!self._frag || self._frag.inserted) {
3951+
self.rawListener();
3952+
}
39323953
});
39333954
}
39343955

39353956
// Now attach the main listener
3936-
this.listener = function () {
3937-
if (composing) return;
3957+
this.listener = this.rawListener = function () {
3958+
if (composing || !self._bound) {
3959+
return;
3960+
}
39383961
var val = number || isRange ? toNumber(el.value) : el.value;
39393962
self.set(val);
39403963
// force update on next tick to avoid lock & same value
@@ -4098,9 +4121,14 @@
40984121
},
40994122

41004123
apply: function apply(el, value) {
4101-
applyTransition(el, value ? 1 : -1, function () {
4124+
if (inDoc(el)) {
4125+
applyTransition(el, value ? 1 : -1, toggle, this.vm);
4126+
} else {
4127+
toggle();
4128+
}
4129+
function toggle() {
41024130
el.style.display = value ? '' : 'none';
4103-
}, this.vm);
4131+
}
41044132
}
41054133
};
41064134

@@ -4135,7 +4163,7 @@
41354163
}
41364164

41374165
var tagRE$1 = /<([\w:]+)/;
4138-
var entityRE = /&\w+;|&#\d+;|&#x[\dA-F]+;/;
4166+
var entityRE = /&#?\w+?;/;
41394167

41404168
/**
41414169
* Convert a string template to a DocumentFragment.
@@ -5670,6 +5698,7 @@
56705698
var twoWay = prop.mode === bindingModes.TWO_WAY;
56715699

56725700
var parentWatcher = this.parentWatcher = new Watcher(parent, parentKey, function (val) {
5701+
val = coerceProp(prop, val);
56735702
if (assertProp(prop, val)) {
56745703
child[childKey] = val;
56755704
}
@@ -7652,7 +7681,7 @@
76527681
} else {
76537682
// for class interpolations, only remove the parts that
76547683
// need to be interpolated.
7655-
this.el.className = removeTags(this.el.className).trim().replace(/\s+/g, ' ');
7684+
setClass(this.el, removeTags(this.el.getAttribute('class')).trim().replace(/\s+/g, ' '));
76567685
}
76577686
}
76587687

@@ -7671,6 +7700,7 @@
76717700
if (this.bind) {
76727701
this.bind();
76737702
}
7703+
this._bound = true;
76747704

76757705
if (this.literal) {
76767706
this.update && this.update(descriptor.raw);
@@ -7706,7 +7736,6 @@
77067736
this.update(watcher.value);
77077737
}
77087738
}
7709-
this._bound = true;
77107739
};
77117740

77127741
/**
@@ -7927,6 +7956,11 @@
79277956
el = transclude(el, options);
79287957
this._initElement(el);
79297958

7959+
// handle v-pre on root node (#2026)
7960+
if (el.nodeType === 1 && getAttr(el, 'v-pre') !== null) {
7961+
return;
7962+
}
7963+
79307964
// root is always compiled per-instance, because
79317965
// container attrs and props can be different every time.
79327966
var contextOptions = this._context && this._context.$options;
@@ -8354,8 +8388,8 @@
83548388
} else {
83558389
/* istanbul ignore if */
83568390
if ('development' !== 'production') {
8357-
if (type === 'component' && commonTagRE.test(id)) {
8358-
warn('Do not use built-in HTML elements as component ' + 'id: ' + id);
8391+
if (type === 'component' && (commonTagRE.test(id) || reservedTagRE.test(id))) {
8392+
warn('Do not use built-in or reserved HTML elements as component ' + 'id: ' + id);
83598393
}
83608394
}
83618395
if (type === 'component' && isPlainObject(definition)) {
@@ -9367,7 +9401,7 @@
93679401
partial: partial
93689402
};
93699403

9370-
Vue.version = '1.0.11';
9404+
Vue.version = '1.0.12';
93719405

93729406
/**
93739407
* Vue and every constructor that extends Vue has an

0 commit comments

Comments
 (0)