diff --git a/dist/vue.common.js b/dist/vue.common.js index 662a74d3..1b96113e 100644 --- a/dist/vue.common.js +++ b/dist/vue.common.js @@ -1,6 +1,6 @@ /*! - * Vue.js v2.5.13 - * (c) 2014-2017 Evan You + * Vue.js v2.5.14 + * (c) 2014-2018 Evan You * Released under the MIT License. */ 'use strict'; @@ -181,9 +181,15 @@ var hyphenate = cached(function (str) { }); /** - * Simple bind, faster than native + * Simple bind polyfill for environments that do not support it... e.g. + * PhantomJS 1.x. Technically we don't need this anymore since native bind is + * now more performant in most browsers, but removing it would be breaking for + * code that was able to run in PhantomJS 1.x, so this must be kept for + * backwards compatibility. */ -function bind (fn, ctx) { + +/* istanbul ignore next */ +function polyfillBind (fn, ctx) { function boundFn (a) { var l = arguments.length; return l @@ -192,11 +198,19 @@ function bind (fn, ctx) { : fn.call(ctx, a) : fn.call(ctx) } - // record original fn length + boundFn._length = fn.length; return boundFn } +function nativeBind (fn, ctx) { + return fn.bind(ctx) +} + +var bind = Function.prototype.bind + ? nativeBind + : polyfillBind; + /** * Convert an Array-like object to a real Array. */ @@ -426,7 +440,7 @@ var config = ({ * Exposed for legacy reasons */ _lifecycleHooks: LIFECYCLE_HOOKS -}); +}) /* */ @@ -470,7 +484,6 @@ function parsePath (path) { /* */ - // can we use __proto__? var hasProto = '__proto__' in {}; @@ -509,7 +522,7 @@ var _isServer; var isServerRendering = function () { if (_isServer === undefined) { /* istanbul ignore if */ - if (!inBrowser && typeof global !== 'undefined') { + if (!inBrowser && !inWeex && typeof global !== 'undefined') { // detect presence of vue-server-renderer and avoid // Webpack shimming the process _isServer = global['process'].env.VUE_ENV === 'server'; @@ -766,8 +779,7 @@ function createTextVNode (val) { // used for static nodes and slot nodes because they may be reused across // multiple renders, cloning them avoids errors when DOM manipulations rely // on their elm reference. -function cloneVNode (vnode, deep) { - var componentOptions = vnode.componentOptions; +function cloneVNode (vnode) { var cloned = new VNode( vnode.tag, vnode.data, @@ -775,7 +787,7 @@ function cloneVNode (vnode, deep) { vnode.text, vnode.elm, vnode.context, - componentOptions, + vnode.componentOptions, vnode.asyncFactory ); cloned.ns = vnode.ns; @@ -786,33 +798,18 @@ function cloneVNode (vnode, deep) { cloned.fnOptions = vnode.fnOptions; cloned.fnScopeId = vnode.fnScopeId; cloned.isCloned = true; - if (deep) { - if (vnode.children) { - cloned.children = cloneVNodes(vnode.children, true); - } - if (componentOptions && componentOptions.children) { - componentOptions.children = cloneVNodes(componentOptions.children, true); - } - } return cloned } -function cloneVNodes (vnodes, deep) { - var len = vnodes.length; - var res = new Array(len); - for (var i = 0; i < len; i++) { - res[i] = cloneVNode(vnodes[i], deep); - } - return res -} - /* * not type checking this file because flow doesn't play well with * dynamically accessing methods on Array prototype */ var arrayProto = Array.prototype; -var arrayMethods = Object.create(arrayProto);[ +var arrayMethods = Object.create(arrayProto); + +var methodsToPatch = [ 'push', 'pop', 'shift', @@ -820,7 +817,12 @@ var arrayMethods = Object.create(arrayProto);[ 'splice', 'sort', 'reverse' -].forEach(function (method) { +]; + +/** + * Intercept mutating methods and emit events + */ +methodsToPatch.forEach(function (method) { // cache original method var original = arrayProto[method]; def(arrayMethods, method, function mutator () { @@ -851,20 +853,20 @@ var arrayMethods = Object.create(arrayProto);[ var arrayKeys = Object.getOwnPropertyNames(arrayMethods); /** - * By default, when a reactive property is set, the new value is - * also converted to become reactive. However when passing down props, - * we don't want to force conversion because the value may be a nested value - * under a frozen data structure. Converting it would defeat the optimization. + * In some cases we may want to disable observation inside a component's + * update computation. */ -var observerState = { - shouldConvert: true -}; +var shouldObserve = true; + +function toggleObserving (value) { + shouldObserve = value; +} /** - * Observer class that are attached to each observed - * object. Once attached, the observer converts target + * Observer class that is attached to each observed + * object. Once attached, the observer converts the target * object's property keys into getter/setters that - * collect dependencies and dispatches updates. + * collect dependencies and dispatch updates. */ var Observer = function Observer (value) { this.value = value; @@ -890,7 +892,7 @@ var Observer = function Observer (value) { Observer.prototype.walk = function walk (obj) { var keys = Object.keys(obj); for (var i = 0; i < keys.length; i++) { - defineReactive(obj, keys[i], obj[keys[i]]); + defineReactive(obj, keys[i]); } }; @@ -940,7 +942,7 @@ function observe (value, asRootData) { if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) { ob = value.__ob__; } else if ( - observerState.shouldConvert && + shouldObserve && !isServerRendering() && (Array.isArray(value) || isPlainObject(value)) && Object.isExtensible(value) && @@ -973,6 +975,9 @@ function defineReactive ( // cater for pre-defined getter/setters var getter = property && property.get; + if (!getter && arguments.length === 2) { + val = obj[key]; + } var setter = property && property.set; var childOb = !shallow && observe(val); @@ -1019,6 +1024,12 @@ function defineReactive ( * already exist. */ function set (target, key, val) { + if (process.env.NODE_ENV !== 'production' && + !Array.isArray(target) && + !isObject(target) + ) { + warn(("Cannot set reactive property on non-object/array value: " + target)); + } if (Array.isArray(target) && isValidArrayIndex(key)) { target.length = Math.max(target.length, key); target.splice(key, 1, val); @@ -1049,6 +1060,12 @@ function set (target, key, val) { * Delete a property and trigger change if necessary. */ function del (target, key) { + if (process.env.NODE_ENV !== 'production' && + !Array.isArray(target) && + !isObject(target) + ) { + warn(("Cannot delete reactive property on non-object/array value: " + target)); + } if (Array.isArray(target) && isValidArrayIndex(key)) { target.splice(key, 1); return @@ -1515,12 +1532,18 @@ function validateProp ( var prop = propOptions[key]; var absent = !hasOwn(propsData, key); var value = propsData[key]; - // handle boolean props - if (isType(Boolean, prop.type)) { + // boolean casting + var booleanIndex = getTypeIndex(Boolean, prop.type); + if (booleanIndex > -1) { if (absent && !hasOwn(prop, 'default')) { value = false; - } else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) { - value = true; + } else if (value === '' || value === hyphenate(key)) { + // only cast empty string / same name to boolean if + // boolean has higher priority + var stringIndex = getTypeIndex(String, prop.type); + if (stringIndex < 0 || booleanIndex < stringIndex) { + value = true; + } } } // check default value @@ -1528,10 +1551,10 @@ function validateProp ( value = getPropDefaultValue(vm, prop, key); // since the default value is a fresh copy, // make sure to observe it. - var prevShouldConvert = observerState.shouldConvert; - observerState.shouldConvert = true; + var prevShouldObserve = shouldObserve; + toggleObserving(true); observe(value); - observerState.shouldConvert = prevShouldConvert; + toggleObserving(prevShouldObserve); } if ( process.env.NODE_ENV !== 'production' && @@ -1664,17 +1687,20 @@ function getType (fn) { return match ? match[1] : '' } -function isType (type, fn) { - if (!Array.isArray(fn)) { - return getType(fn) === getType(type) +function isSameType (a, b) { + return getType(a) === getType(b) +} + +function getTypeIndex (type, expectedTypes) { + if (!Array.isArray(expectedTypes)) { + return isSameType(expectedTypes, type) ? 0 : -1 } - for (var i = 0, len = fn.length; i < len; i++) { - if (getType(fn[i]) === getType(type)) { - return true + for (var i = 0, len = expectedTypes.length; i < len; i++) { + if (isSameType(expectedTypes[i], type)) { + return i } } - /* istanbul ignore next */ - return false + return -1 } /* */ @@ -1737,19 +1763,19 @@ function flushCallbacks () { } } -// Here we have async deferring wrappers using both micro and macro tasks. -// In < 2.4 we used micro tasks everywhere, but there are some scenarios where -// micro tasks have too high a priority and fires in between supposedly +// Here we have async deferring wrappers using both microtasks and (macro) tasks. +// In < 2.4 we used microtasks everywhere, but there are some scenarios where +// microtasks have too high a priority and fire in between supposedly // sequential events (e.g. #4521, #6690) or even between bubbling of the same -// event (#6566). However, using macro tasks everywhere also has subtle problems +// event (#6566). However, using (macro) tasks everywhere also has subtle problems // when state is changed right before repaint (e.g. #6813, out-in transitions). -// Here we use micro task by default, but expose a way to force macro task when +// Here we use microtask by default, but expose a way to force (macro) task when // needed (e.g. in event handlers attached by v-on). var microTimerFunc; var macroTimerFunc; var useMacroTask = false; -// Determine (macro) Task defer implementation. +// Determine (macro) task defer implementation. // Technically setImmediate should be the ideal choice, but it's only available // in IE. The only polyfill that consistently queues the callback after all DOM // events triggered in the same loop is by using MessageChannel. @@ -1776,7 +1802,7 @@ if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) { }; } -// Determine MicroTask defer implementation. +// Determine microtask defer implementation. /* istanbul ignore next, $flow-disable-line */ if (typeof Promise !== 'undefined' && isNative(Promise)) { var p = Promise.resolve(); @@ -1796,7 +1822,7 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) { /** * Wrap a function so that if any code inside triggers state change, - * the changes are queued using a Task instead of a MicroTask. + * the changes are queued using a (macro) task instead of a microtask. */ function withMacroTask (fn) { return fn._withTask || (fn._withTask = function () { @@ -1885,8 +1911,7 @@ if (process.env.NODE_ENV !== 'production') { }; var hasProxy = - typeof Proxy !== 'undefined' && - Proxy.toString().match(/native code/); + typeof Proxy !== 'undefined' && isNative(Proxy); if (hasProxy) { var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact'); @@ -2814,29 +2839,30 @@ function updateChildComponent ( // update $attrs and $listeners hash // these are also reactive so they may trigger child update if the child // used them during render - vm.$attrs = (parentVnode.data && parentVnode.data.attrs) || emptyObject; + vm.$attrs = parentVnode.data.attrs || emptyObject; vm.$listeners = listeners || emptyObject; // update props if (propsData && vm.$options.props) { - observerState.shouldConvert = false; + toggleObserving(false); var props = vm._props; var propKeys = vm.$options._propKeys || []; for (var i = 0; i < propKeys.length; i++) { var key = propKeys[i]; - props[key] = validateProp(key, vm.$options.props, propsData, vm); + var propOptions = vm.$options.props; // wtf flow? + props[key] = validateProp(key, propOptions, propsData, vm); } - observerState.shouldConvert = true; + toggleObserving(true); // keep a copy of raw propsData vm.$options.propsData = propsData; } // update listeners - if (listeners) { - var oldListeners = vm.$options._parentListeners; - vm.$options._parentListeners = listeners; - updateComponentListeners(vm, listeners, oldListeners); - } + listeners = listeners || emptyObject; + var oldListeners = vm.$options._parentListeners; + vm.$options._parentListeners = listeners; + updateComponentListeners(vm, listeners, oldListeners); + // resolve slots + force update if has children if (hasChildren) { vm.$slots = resolveSlots(renderChildren, parentVnode.context); @@ -2890,6 +2916,8 @@ function deactivateChildComponent (vm, direct) { } function callHook (vm, hook) { + // #7573 disable dep collection when invoking lifecycle hooks + pushTarget(); var handlers = vm.$options[hook]; if (handlers) { for (var i = 0, j = handlers.length; i < j; i++) { @@ -2903,6 +2931,7 @@ function callHook (vm, hook) { if (vm._hasHookEvent) { vm.$emit('hook:' + hook); } + popTarget(); } /* */ @@ -3047,7 +3076,7 @@ function queueWatcher (watcher) { /* */ -var uid$2 = 0; +var uid$1 = 0; /** * A watcher parses an expression, collects dependencies, @@ -3076,7 +3105,7 @@ var Watcher = function Watcher ( this.deep = this.user = this.lazy = this.sync = false; } this.cb = cb; - this.id = ++uid$2; // uid for batching + this.id = ++uid$1; // uid for batching this.active = true; this.dirty = this.lazy; // for lazy watchers this.deps = []; @@ -3301,7 +3330,9 @@ function initProps (vm, propsOptions) { var keys = vm.$options._propKeys = []; var isRoot = !vm.$parent; // root instance props should be converted - observerState.shouldConvert = isRoot; + if (!isRoot) { + toggleObserving(false); + } var loop = function ( key ) { keys.push(key); var value = validateProp(key, propsOptions, propsData, vm); @@ -3338,7 +3369,7 @@ function initProps (vm, propsOptions) { }; for (var key in propsOptions) loop( key ); - observerState.shouldConvert = true; + toggleObserving(true); } function initData (vm) { @@ -3384,11 +3415,15 @@ function initData (vm) { } function getData (data, vm) { + // #7573 disable dep collection when invoking data getters + pushTarget(); try { return data.call(vm, vm) } catch (e) { handleError(e, vm, "data()"); return {} + } finally { + popTarget(); } } @@ -3526,7 +3561,7 @@ function initWatch (vm, watch) { function createWatcher ( vm, - keyOrFn, + expOrFn, handler, options ) { @@ -3537,7 +3572,7 @@ function createWatcher ( if (typeof handler === 'string') { handler = vm[handler]; } - return vm.$watch(keyOrFn, handler, options) + return vm.$watch(expOrFn, handler, options) } function stateMixin (Vue) { @@ -3601,7 +3636,7 @@ function initProvide (vm) { function initInjections (vm) { var result = resolveInject(vm.$options.inject, vm); if (result) { - observerState.shouldConvert = false; + toggleObserving(false); Object.keys(result).forEach(function (key) { /* istanbul ignore else */ if (process.env.NODE_ENV !== 'production') { @@ -3617,7 +3652,7 @@ function initInjections (vm) { defineReactive(vm, key, result[key]); } }); - observerState.shouldConvert = true; + toggleObserving(true); } } @@ -3637,7 +3672,7 @@ function resolveInject (inject, vm) { var provideKey = inject[key].from; var source = vm; while (source) { - if (source._provided && provideKey in source._provided) { + if (source._provided && hasOwn(source._provided, provideKey)) { result[key] = source._provided[provideKey]; break } @@ -3752,6 +3787,14 @@ function resolveFilter (id) { /* */ +function isKeyNotMatch (expect, actual) { + if (Array.isArray(expect)) { + return expect.indexOf(actual) === -1 + } else { + return expect !== actual + } +} + /** * Runtime helper for checking keyCodes from config. * exposed as Vue.prototype._k @@ -3760,16 +3803,15 @@ function resolveFilter (id) { function checkKeyCodes ( eventKeyCode, key, - builtInAlias, - eventKeyName + builtInKeyCode, + eventKeyName, + builtInKeyName ) { - var keyCodes = config.keyCodes[key] || builtInAlias; - if (keyCodes) { - if (Array.isArray(keyCodes)) { - return keyCodes.indexOf(eventKeyCode) === -1 - } else { - return keyCodes !== eventKeyCode - } + var mappedKeyCode = config.keyCodes[key] || builtInKeyCode; + if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { + return isKeyNotMatch(builtInKeyName, eventKeyName) + } else if (mappedKeyCode) { + return isKeyNotMatch(mappedKeyCode, eventKeyCode) } else if (eventKeyName) { return hyphenate(eventKeyName) !== key } @@ -3841,11 +3883,9 @@ function renderStatic ( var cached = this._staticTrees || (this._staticTrees = []); var tree = cached[index]; // if has already-rendered static tree and not inside v-for, - // we can reuse the same tree by doing a shallow clone. + // we can reuse the same tree. if (tree && !isInFor) { - return Array.isArray(tree) - ? cloneVNodes(tree) - : cloneVNode(tree) + return tree } // otherwise, render a fresh tree. tree = cached[index] = this.$options.staticRenderFns[index].call( @@ -3969,7 +4009,7 @@ function FunctionalRenderContext ( if (options._scopeId) { this._c = function (a, b, c, d) { var vnode = createElement(contextVm, a, b, c, d, needNormalization); - if (vnode) { + if (vnode && !Array.isArray(vnode)) { vnode.fnScopeId = options._scopeId; vnode.fnContext = parent; } @@ -4012,14 +4052,23 @@ function createFunctionalComponent ( var vnode = options.render.call(null, renderContext._c, renderContext); if (vnode instanceof VNode) { - vnode.fnContext = contextVm; - vnode.fnOptions = options; - if (data.slot) { - (vnode.data || (vnode.data = {})).slot = data.slot; + setFunctionalContextForVNode(vnode, data, contextVm, options); + return vnode + } else if (Array.isArray(vnode)) { + var vnodes = normalizeChildren(vnode) || []; + for (var i = 0; i < vnodes.length; i++) { + setFunctionalContextForVNode(vnodes[i], data, contextVm, options); } + return vnodes } +} - return vnode +function setFunctionalContextForVNode (vnode, data, vm, options) { + vnode.fnContext = vm; + vnode.fnOptions = options; + if (data.slot) { + (vnode.data || (vnode.data = {})).slot = data.slot; + } } function mergeProps (to, from) { @@ -4057,7 +4106,15 @@ var componentVNodeHooks = { parentElm, refElm ) { - if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) { + if ( + vnode.componentInstance && + !vnode.componentInstance._isDestroyed && + vnode.data.keepAlive + ) { + // kept-alive components, treat as a patch + var mountedNode = vnode; // work around flow + componentVNodeHooks.prepatch(mountedNode, mountedNode); + } else { var child = vnode.componentInstance = createComponentInstanceForVnode( vnode, activeInstance, @@ -4065,10 +4122,6 @@ var componentVNodeHooks = { refElm ); child.$mount(hydrating ? vnode.elm : undefined, hydrating); - } else if (vnode.data.keepAlive) { - // kept-alive components, treat as a patch - var mountedNode = vnode; // work around flow - componentVNodeHooks.prepatch(mountedNode, mountedNode); } }, @@ -4376,8 +4429,11 @@ function _createElement ( // direct component options / constructor vnode = createComponent(tag, data, context, children); } - if (isDef(vnode)) { - if (ns) { applyNS(vnode, ns); } + if (Array.isArray(vnode)) { + return vnode + } else if (isDef(vnode)) { + if (isDef(ns)) { applyNS(vnode, ns); } + if (isDef(data)) { registerDeepBindings(data); } return vnode } else { return createEmptyVNode() @@ -4394,13 +4450,26 @@ function applyNS (vnode, ns, force) { if (isDef(vnode.children)) { for (var i = 0, l = vnode.children.length; i < l; i++) { var child = vnode.children[i]; - if (isDef(child.tag) && (isUndef(child.ns) || isTrue(force))) { + if (isDef(child.tag) && ( + isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) { applyNS(child, ns, force); } } } } +// ref #5318 +// necessary to ensure parent re-render when deep bindings like :style and +// :class are used on slot nodes +function registerDeepBindings (data) { + if (isObject(data.style)) { + traverse(data.style); + } + if (isObject(data.class)) { + traverse(data.class); + } +} + /* */ function initRender (vm) { @@ -4452,20 +4521,17 @@ function renderMixin (Vue) { var render = ref.render; var _parentVnode = ref._parentVnode; - if (vm._isMounted) { - // if the parent didn't update, the slot nodes will be the ones from - // last render. They need to be cloned to ensure "freshness" for this render. + // reset _rendered flag on slots for duplicate slot check + if (process.env.NODE_ENV !== 'production') { for (var key in vm.$slots) { - var slot = vm.$slots[key]; - // _rendered is a flag added by renderSlot, but may not be present - // if the slot is passed from manually written render functions - if (slot._rendered || (slot[0] && slot[0].elm)) { - vm.$slots[key] = cloneVNodes(slot, true /* deep */); - } + // $flow-disable-line + vm.$slots[key]._rendered = false; } } - vm.$scopedSlots = (_parentVnode && _parentVnode.data.scopedSlots) || emptyObject; + if (_parentVnode) { + vm.$scopedSlots = _parentVnode.data.scopedSlots || emptyObject; + } // set parent vnode. this allows render functions to have access // to the data on the placeholder node. @@ -4513,13 +4579,13 @@ function renderMixin (Vue) { /* */ -var uid$1 = 0; +var uid$3 = 0; function initMixin (Vue) { Vue.prototype._init = function (options) { var vm = this; // a uid - vm._uid = uid$1++; + vm._uid = uid$3++; var startTag, endTag; /* istanbul ignore if */ @@ -4652,20 +4718,20 @@ function dedupe (latest, extended, sealed) { } } -function Vue$3 (options) { +function Vue (options) { if (process.env.NODE_ENV !== 'production' && - !(this instanceof Vue$3) + !(this instanceof Vue) ) { warn('Vue is a constructor and should be called with the `new` keyword'); } this._init(options); } -initMixin(Vue$3); -stateMixin(Vue$3); -eventsMixin(Vue$3); -lifecycleMixin(Vue$3); -renderMixin(Vue$3); +initMixin(Vue); +stateMixin(Vue); +eventsMixin(Vue); +lifecycleMixin(Vue); +renderMixin(Vue); /* */ @@ -4948,11 +5014,11 @@ var KeepAlive = { } return vnode || (slot && slot[0]) } -}; +} var builtInComponents = { KeepAlive: KeepAlive -}; +} /* */ @@ -5000,20 +5066,25 @@ function initGlobalAPI (Vue) { initAssetRegisters(Vue); } -initGlobalAPI(Vue$3); +initGlobalAPI(Vue); -Object.defineProperty(Vue$3.prototype, '$isServer', { +Object.defineProperty(Vue.prototype, '$isServer', { get: isServerRendering }); -Object.defineProperty(Vue$3.prototype, '$ssrContext', { +Object.defineProperty(Vue.prototype, '$ssrContext', { get: function get () { /* istanbul ignore next */ return this.$vnode && this.$vnode.ssrContext } }); -Vue$3.version = '2.5.13'; +// expose FunctionalRenderContext for ssr runtime helper installation +Object.defineProperty(Vue, 'FunctionalRenderContext', { + value: FunctionalRenderContext +}); + +Vue.version = '2.5.14'; /* */ @@ -5287,8 +5358,8 @@ function setTextContent (node, text) { node.textContent = text; } -function setAttribute (node, key, val) { - node.setAttribute(key, val); +function setStyleScope (node, scopeId) { + node.setAttribute(scopeId, ''); } @@ -5304,7 +5375,7 @@ var nodeOps = Object.freeze({ nextSibling: nextSibling, tagName: tagName, setTextContent: setTextContent, - setAttribute: setAttribute + setStyleScope: setStyleScope }); /* */ @@ -5322,11 +5393,11 @@ var ref = { destroy: function destroy (vnode) { registerRef(vnode, true); } -}; +} function registerRef (vnode, isRemoval) { var key = vnode.data.ref; - if (!key) { return } + if (!isDef(key)) { return } var vm = vnode.context; var ref = vnode.componentInstance || vnode.elm; @@ -5457,7 +5528,25 @@ function createPatchFunction (backend) { } var creatingElmInVPre = 0; - function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) { + + function createElm ( + vnode, + insertedVnodeQueue, + parentElm, + refElm, + nested, + ownerArray, + index + ) { + if (isDef(vnode.elm) && isDef(ownerArray)) { + // This vnode was used in a previous render! + // now it's used as a new node, overwriting its elm would cause + // potential patch errors down the road when it's used as an insertion + // reference node. Instead, we clone the node on-demand before creating + // associated DOM element for it. + vnode = ownerArray[index] = cloneVNode(vnode); + } + vnode.isRootInsert = !nested; // for transition enter check if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) { return @@ -5480,6 +5569,7 @@ function createPatchFunction (backend) { ); } } + vnode.elm = vnode.ns ? nodeOps.createElementNS(vnode.ns, tag) : nodeOps.createElement(tag, vnode); @@ -5585,7 +5675,7 @@ function createPatchFunction (backend) { checkDuplicateKeys(children); } for (var i = 0; i < children.length; ++i) { - createElm(children[i], insertedVnodeQueue, vnode.elm, null, true); + createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i); } } else if (isPrimitive(vnode.text)) { nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text))); @@ -5616,12 +5706,12 @@ function createPatchFunction (backend) { function setScope (vnode) { var i; if (isDef(i = vnode.fnScopeId)) { - nodeOps.setAttribute(vnode.elm, i, ''); + nodeOps.setStyleScope(vnode.elm, i); } else { var ancestor = vnode; while (ancestor) { if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) { - nodeOps.setAttribute(vnode.elm, i, ''); + nodeOps.setStyleScope(vnode.elm, i); } ancestor = ancestor.parent; } @@ -5632,13 +5722,13 @@ function createPatchFunction (backend) { i !== vnode.fnContext && isDef(i = i.$options._scopeId) ) { - nodeOps.setAttribute(vnode.elm, i, ''); + nodeOps.setStyleScope(vnode.elm, i); } } function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) { for (; startIdx <= endIdx; ++startIdx) { - createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm); + createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx); } } @@ -5748,7 +5838,7 @@ function createPatchFunction (backend) { ? oldKeyToIdx[newStartVnode.key] : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx); if (isUndef(idxInOld)) { // New element - createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm); + createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx); } else { vnodeToMove = oldCh[idxInOld]; if (sameVnode(vnodeToMove, newStartVnode)) { @@ -5757,7 +5847,7 @@ function createPatchFunction (backend) { canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm); } else { // same key but different element. treat as new element - createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm); + createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx); } } newStartVnode = newCh[++newStartIdx]; @@ -6095,7 +6185,7 @@ var directives = { destroy: function unbindDirectives (vnode) { updateDirectives(vnode, emptyNode); } -}; +} function updateDirectives (oldVnode, vnode) { if (oldVnode.data.directives || vnode.data.directives) { @@ -6206,7 +6296,7 @@ function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) { var baseModules = [ ref, directives -]; +] /* */ @@ -6252,7 +6342,9 @@ function updateAttrs (oldVnode, vnode) { } function setAttr (el, key, value) { - if (isBooleanAttr(key)) { + if (el.tagName.indexOf('-') > -1) { + baseSetAttr(el, key, value); + } else if (isBooleanAttr(key)) { // set attribute for blank value // e.g. if (isFalsyAttrValue(value)) { @@ -6274,35 +6366,39 @@ function setAttr (el, key, value) { el.setAttributeNS(xlinkNS, key, value); } } else { - if (isFalsyAttrValue(value)) { - el.removeAttribute(key); - } else { - // #7138: IE10 & 11 fires input event when setting placeholder on - //