|
1 | 1 | /*!
|
2 |
| - * Vue.js v1.0.12 |
| 2 | + * Vue.js v1.0.13 |
3 | 3 | * (c) 2015 Evan You
|
4 | 4 | * Released under the MIT License.
|
5 | 5 | */
|
|
851 | 851 | }
|
852 | 852 | }
|
853 | 853 |
|
854 |
| - /** |
855 |
| - * Replace all interpolation tags in a piece of text. |
856 |
| - * |
857 |
| - * @param {String} text |
858 |
| - * @return {String} |
859 |
| - */ |
860 |
| - |
861 |
| - function removeTags(text) { |
862 |
| - return text.replace(tagRE, ''); |
863 |
| - } |
864 |
| - |
865 | 854 | var text$1 = Object.freeze({
|
866 | 855 | compileRegex: compileRegex,
|
867 | 856 | parseText: parseText,
|
868 |
| - tokensToExp: tokensToExp, |
869 |
| - removeTags: removeTags |
| 857 | + tokensToExp: tokensToExp |
870 | 858 | });
|
871 | 859 |
|
872 | 860 | var delimiters = ['{{', '}}'];
|
|
1967 | 1955 |
|
1968 | 1956 | def(arrayProto, '$set', function $set(index, val) {
|
1969 | 1957 | if (index >= this.length) {
|
1970 |
| - this.length = index + 1; |
| 1958 | + this.length = Number(index) + 1; |
1971 | 1959 | }
|
1972 | 1960 | return this.splice(index, 1, val)[0];
|
1973 | 1961 | });
|
|
2083 | 2071 |
|
2084 | 2072 | Observer.prototype.walk = function (obj) {
|
2085 | 2073 | var keys = Object.keys(obj);
|
2086 |
| - var i = keys.length; |
2087 |
| - while (i--) { |
| 2074 | + for (var i = 0, l = keys.length; i < l; i++) { |
2088 | 2075 | this.convert(keys[i], obj[keys[i]]);
|
2089 | 2076 | }
|
2090 | 2077 | };
|
|
2096 | 2083 | */
|
2097 | 2084 |
|
2098 | 2085 | Observer.prototype.observeArray = function (items) {
|
2099 |
| - var i = items.length; |
2100 |
| - while (i--) { |
| 2086 | + for (var i = 0, l = items.length; i < l; i++) { |
2101 | 2087 | observe(items[i]);
|
2102 | 2088 | }
|
2103 | 2089 | };
|
|
2161 | 2147 | */
|
2162 | 2148 |
|
2163 | 2149 | function copyAugment(target, src, keys) {
|
2164 |
| - var i = keys.length; |
2165 |
| - var key; |
2166 |
| - while (i--) { |
2167 |
| - key = keys[i]; |
| 2150 | + for (var i = 0, l = keys.length; i < l; i++) { |
| 2151 | + var key = keys[i]; |
2168 | 2152 | def(target, key, src[key]);
|
2169 | 2153 | }
|
2170 | 2154 | }
|
|
3348 | 3332 | var cloak = {
|
3349 | 3333 | bind: function bind() {
|
3350 | 3334 | var el = this.el;
|
3351 |
| - this.vm.$once('hook:compiled', function () { |
| 3335 | + this.vm.$once('pre-hook:compiled', function () { |
3352 | 3336 | el.removeAttribute('v-cloak');
|
3353 | 3337 | });
|
3354 | 3338 | }
|
|
3360 | 3344 | }
|
3361 | 3345 | };
|
3362 | 3346 |
|
| 3347 | + var ON = 700; |
| 3348 | + var MODEL = 800; |
| 3349 | + var BIND = 850; |
| 3350 | + var TRANSITION = 1100; |
| 3351 | + var EL = 1500; |
| 3352 | + var COMPONENT = 1500; |
| 3353 | + var PARTIAL = 1750; |
| 3354 | + var SLOT = 1750; |
| 3355 | + var FOR = 2000; |
| 3356 | + var IF = 2000; |
| 3357 | + |
3363 | 3358 | var el = {
|
3364 | 3359 |
|
3365 |
| - priority: 1500, |
| 3360 | + priority: EL, |
3366 | 3361 |
|
3367 | 3362 | bind: function bind() {
|
3368 | 3363 | /* istanbul ignore if */
|
|
3513 | 3508 |
|
3514 | 3509 | var bind = {
|
3515 | 3510 |
|
3516 |
| - priority: 850, |
| 3511 | + priority: BIND, |
3517 | 3512 |
|
3518 | 3513 | bind: function bind() {
|
3519 | 3514 | var attr = this.arg;
|
|
3563 | 3558 | handleObject: style.handleObject,
|
3564 | 3559 |
|
3565 | 3560 | handleSingle: function handleSingle(attr, 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... |
| 3561 | + var el = this.el; |
| 3562 | + var interp = this.descriptor.interp; |
| 3563 | + if (!interp && attrWithPropsRE.test(attr) && attr in el) { |
| 3564 | + el[attr] = attr === 'value' ? value == null // IE9 will set input.value to "null" for null... |
3568 | 3565 | ? '' : value : value;
|
3569 | 3566 | }
|
3570 | 3567 | // set model props
|
3571 | 3568 | var modelProp = modelProps[attr];
|
3572 |
| - if (modelProp) { |
3573 |
| - this.el[modelProp] = value; |
| 3569 | + if (!interp && modelProp) { |
| 3570 | + el[modelProp] = value; |
3574 | 3571 | // update v-model if present
|
3575 |
| - var model = this.el.__v_model; |
| 3572 | + var model = el.__v_model; |
3576 | 3573 | if (model) {
|
3577 | 3574 | model.listener();
|
3578 | 3575 | }
|
3579 | 3576 | }
|
3580 | 3577 | // do not set value attribute for textarea
|
3581 |
| - if (attr === 'value' && this.el.tagName === 'TEXTAREA') { |
3582 |
| - this.el.removeAttribute(attr); |
| 3578 | + if (attr === 'value' && el.tagName === 'TEXTAREA') { |
| 3579 | + el.removeAttribute(attr); |
3583 | 3580 | return;
|
3584 | 3581 | }
|
3585 | 3582 | // update attribute
|
3586 | 3583 | if (value != null && value !== false) {
|
3587 |
| - if (xlinkRE.test(attr)) { |
3588 |
| - this.el.setAttributeNS(xlinkNS, attr, value); |
| 3584 | + if (attr === 'class') { |
| 3585 | + // handle edge case #1960: |
| 3586 | + // class interpolation should not overwrite Vue transition class |
| 3587 | + if (el.__v_trans) { |
| 3588 | + value += ' ' + el.__v_trans.id + '-transition'; |
| 3589 | + } |
| 3590 | + setClass(el, value); |
| 3591 | + } else if (xlinkRE.test(attr)) { |
| 3592 | + el.setAttributeNS(xlinkNS, attr, value); |
3589 | 3593 | } else {
|
3590 |
| - this.el.setAttribute(attr, value); |
| 3594 | + el.setAttribute(attr, value); |
3591 | 3595 | }
|
3592 | 3596 | } else {
|
3593 |
| - this.el.removeAttribute(attr); |
| 3597 | + el.removeAttribute(attr); |
3594 | 3598 | }
|
3595 | 3599 | }
|
3596 | 3600 | };
|
|
3646 | 3650 | var on = {
|
3647 | 3651 |
|
3648 | 3652 | acceptStatement: true,
|
3649 |
| - priority: 700, |
| 3653 | + priority: ON, |
3650 | 3654 |
|
3651 | 3655 | bind: function bind() {
|
3652 | 3656 | // deal with iframes
|
|
4037 | 4041 |
|
4038 | 4042 | var model = {
|
4039 | 4043 |
|
4040 |
| - priority: 800, |
| 4044 | + priority: MODEL, |
4041 | 4045 | twoWay: true,
|
4042 | 4046 | handlers: handlers,
|
4043 | 4047 | params: ['lazy', 'number', 'debounce'],
|
|
4609 | 4613 |
|
4610 | 4614 | var vIf = {
|
4611 | 4615 |
|
4612 |
| - priority: 2000, |
| 4616 | + priority: IF, |
4613 | 4617 |
|
4614 | 4618 | bind: function bind() {
|
4615 | 4619 | var el = this.el;
|
|
4672 | 4676 |
|
4673 | 4677 | var vFor = {
|
4674 | 4678 |
|
4675 |
| - priority: 2000, |
| 4679 | + priority: FOR, |
4676 | 4680 |
|
4677 | 4681 | params: ['track-by', 'stagger', 'enter-stagger', 'leave-stagger'],
|
4678 | 4682 |
|
|
5667 | 5671 |
|
5668 | 5672 | var transition = {
|
5669 | 5673 |
|
5670 |
| - priority: 1100, |
| 5674 | + priority: TRANSITION, |
5671 | 5675 |
|
5672 | 5676 | update: function update(id, oldId) {
|
5673 | 5677 | var el = this.el;
|
|
5718 | 5722 | // important: defer the child watcher creation until
|
5719 | 5723 | // the created hook (after data observation)
|
5720 | 5724 | var self = this;
|
5721 |
| - child.$once('hook:created', function () { |
| 5725 | + child.$once('pre-hook:created', function () { |
5722 | 5726 | self.childWatcher = new Watcher(child, childKey, function (val) {
|
5723 | 5727 | parentWatcher.set(val);
|
5724 | 5728 | }, {
|
|
5741 | 5745 |
|
5742 | 5746 | var component = {
|
5743 | 5747 |
|
5744 |
| - priority: 1500, |
| 5748 | + priority: COMPONENT, |
5745 | 5749 |
|
5746 | 5750 | params: ['keep-alive', 'transition-mode', 'inline-template'],
|
5747 | 5751 |
|
|
6934 | 6938 | // attribute interpolations
|
6935 | 6939 | if (tokens) {
|
6936 | 6940 | value = tokensToExp(tokens);
|
6937 |
| - if (name === 'class') { |
6938 |
| - pushDir('class', internalDirectives['class'], true); |
6939 |
| - } else { |
6940 |
| - arg = name; |
6941 |
| - pushDir('bind', publicDirectives.bind, true); |
6942 |
| - } |
| 6941 | + arg = name; |
| 6942 | + pushDir('bind', publicDirectives.bind, true); |
6943 | 6943 | // warn against mixing mustaches with v-bind
|
6944 | 6944 | if ('development' !== 'production') {
|
6945 | 6945 | if (name === 'class' && Array.prototype.some.call(attrs, function (attr) {
|
|
7600 | 7600 | */
|
7601 | 7601 |
|
7602 | 7602 | Vue.prototype._callHook = function (hook) {
|
| 7603 | + this.$emit('pre-hook:' + hook); |
7603 | 7604 | var handlers = this.$options[hook];
|
7604 | 7605 | if (handlers) {
|
7605 | 7606 | for (var i = 0, j = handlers.length; i < j; i++) {
|
|
7676 | 7677 | // remove attribute
|
7677 | 7678 | if ((name !== 'cloak' || this.vm._isCompiled) && this.el && this.el.removeAttribute) {
|
7678 | 7679 | var attr = descriptor.attr || 'v-' + name;
|
7679 |
| - if (attr !== 'class') { |
7680 |
| - this.el.removeAttribute(attr); |
7681 |
| - } else { |
7682 |
| - // for class interpolations, only remove the parts that |
7683 |
| - // need to be interpolated. |
7684 |
| - setClass(this.el, removeTags(this.el.getAttribute('class')).trim().replace(/\s+/g, ' ')); |
7685 |
| - } |
| 7680 | + this.el.removeAttribute(attr); |
7686 | 7681 | }
|
7687 | 7682 |
|
7688 | 7683 | // copy def properties
|
|
7792 | 7787 | called = true;
|
7793 | 7788 | }
|
7794 | 7789 | }, {
|
7795 |
| - immediate: true |
| 7790 | + immediate: true, |
| 7791 | + user: false |
7796 | 7792 | });(this._paramUnwatchFns || (this._paramUnwatchFns = [])).push(unwatch);
|
7797 | 7793 | };
|
7798 | 7794 |
|
|
8481 | 8477 | var watcher = new Watcher(vm, expOrFn, cb, {
|
8482 | 8478 | deep: options && options.deep,
|
8483 | 8479 | sync: options && options.sync,
|
8484 |
| - filters: parsed && parsed.filters |
| 8480 | + filters: parsed && parsed.filters, |
| 8481 | + user: !options || options.user !== false |
8485 | 8482 | });
|
8486 | 8483 | if (options && options.immediate) {
|
8487 | 8484 | cb.call(vm, watcher.value);
|
|
9245 | 9242 |
|
9246 | 9243 | var partial = {
|
9247 | 9244 |
|
9248 |
| - priority: 1750, |
| 9245 | + priority: PARTIAL, |
9249 | 9246 |
|
9250 | 9247 | params: ['name'],
|
9251 | 9248 |
|
|
9296 | 9293 |
|
9297 | 9294 | var slot = {
|
9298 | 9295 |
|
9299 |
| - priority: 1750, |
| 9296 | + priority: SLOT, |
9300 | 9297 |
|
9301 | 9298 | bind: function bind() {
|
9302 | 9299 | var host = this.vm;
|
|
9401 | 9398 | partial: partial
|
9402 | 9399 | };
|
9403 | 9400 |
|
9404 |
| - Vue.version = '1.0.12'; |
| 9401 | + Vue.version = '1.0.13'; |
9405 | 9402 |
|
9406 | 9403 | /**
|
9407 | 9404 | * Vue and every constructor that extends Vue has an
|
|
0 commit comments