diff --git a/src/compiler/parser/html-parser.js b/src/compiler/parser/html-parser.js index ce8f9c060..f95e8b435 100644 --- a/src/compiler/parser/html-parser.js +++ b/src/compiler/parser/html-parser.js @@ -131,10 +131,10 @@ export function parseHTML (html, options) { options.chars(text) } } else { - const stackedTag = lastTag.toLowerCase() - const reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(]*>)', 'i')) - let endTagLength = 0 - const rest = html.replace(reStackedTag, function (all, text, endTag) { + var stackedTag = lastTag.toLowerCase() + var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(]*>)', 'i')) + var endTagLength = 0 + var rest = html.replace(reStackedTag, function (all, text, endTag) { endTagLength = endTag.length if (stackedTag !== 'script' && stackedTag !== 'style' && stackedTag !== 'noscript') { text = text diff --git a/src/core/util/env.js b/src/core/util/env.js index feebbfe66..71af81145 100644 --- a/src/core/util/env.js +++ b/src/core/util/env.js @@ -51,9 +51,9 @@ export const nextTick = (function () { /* istanbul ignore else */ if (typeof MutationObserver !== 'undefined' && !hasMutationObserverBug) { - let counter = 1 - const observer = new MutationObserver(nextTickHandler) - const textNode = document.createTextNode(String(counter)) + var counter = 1 + var observer = new MutationObserver(nextTickHandler) + var textNode = document.createTextNode(String(counter)) observer.observe(textNode, { characterData: true }) @@ -65,7 +65,7 @@ export const nextTick = (function () { // webpack attempts to inject a shim for setImmediate // if it is used as a global, so we have to work around that to // avoid bundling unnecessary code. - const context = inBrowser + var context = inBrowser ? window : typeof global !== 'undefined' ? global : {} timerFunc = context.setImmediate || setTimeout diff --git a/src/core/vdom/create-component.js b/src/core/vdom/create-component.js index 26b1956c3..a69dbd04b 100644 --- a/src/core/vdom/create-component.js +++ b/src/core/vdom/create-component.js @@ -57,24 +57,7 @@ export function createComponent ( // functional component if (Ctor.options.functional) { - const props = {} - const propOptions = Ctor.options.props - if (propOptions) { - Object.keys(propOptions).forEach(key => { - props[key] = validateProp(key, propOptions, propsData) - }) - } - return Ctor.options.render.call( - null, - context.$createElement, - { - props, - data, - parent: context, - children: normalizeChildren(children), - slots: () => resolveSlots(children) - } - ) + return createFunctionalComponent(Ctor, propsData, data, context, children) } // extract listeners, since these needs to be treated as @@ -102,6 +85,27 @@ export function createComponent ( return vnode } +function createFunctionalComponent (Ctor, propsData, data, context, children) { + const props = {} + const propOptions = Ctor.options.props + if (propOptions) { + for (const key in propOptions) { + props[key] = validateProp(key, propOptions, propsData) + } + } + return Ctor.options.render.call( + null, + context.$createElement, + { + props, + data, + parent: context, + children: normalizeChildren(children), + slots: () => resolveSlots(children) + } + ) +} + export function createComponentInstanceForVnode ( vnode: any, // we know it's MountedComponentVNode but flow doesn't parent: any // activeInstance in lifecycle state diff --git a/src/platforms/web/runtime/components/transition-group.js b/src/platforms/web/runtime/components/transition-group.js index cd0cc1b76..c65db0099 100644 --- a/src/platforms/web/runtime/components/transition-group.js +++ b/src/platforms/web/runtime/components/transition-group.js @@ -120,8 +120,8 @@ export default { children.forEach(c => { if (c.data.moved) { - const el = c.elm - const s = el.style + var el = c.elm + var s = el.style addTransitionClass(el, moveClass) s.transform = s.WebkitTransform = s.transitionDuration = '' el._moveDest = c.data.pos diff --git a/src/platforms/web/runtime/components/transition.js b/src/platforms/web/runtime/components/transition.js index 4430e17f0..31ce800a1 100644 --- a/src/platforms/web/runtime/components/transition.js +++ b/src/platforms/web/runtime/components/transition.js @@ -141,8 +141,8 @@ export default { }) return placeholder(h, rawChild) } else if (mode === 'in-out') { - let delayedLeave - const performLeave = () => { delayedLeave() } + var delayedLeave + var performLeave = () => { delayedLeave() } mergeVNodeHook(data, 'afterEnter', performLeave) mergeVNodeHook(data, 'enterCancelled', performLeave) mergeVNodeHook(oldData, 'delayLeave', leave => { diff --git a/src/platforms/web/runtime/modules/transition.js b/src/platforms/web/runtime/modules/transition.js index d9668fddd..d438bd246 100644 --- a/src/platforms/web/runtime/modules/transition.js +++ b/src/platforms/web/runtime/modules/transition.js @@ -94,7 +94,7 @@ export function enter (vnode: VNodeWithData) { if (!vnode.data.show) { // remove pending leave element on enter by injecting an insert hook - const hooks = vnode.data.hook || (vnode.data.hook = {}) + var hooks = vnode.data.hook || (vnode.data.hook = {}) hooks._transitionInsert = () => { const parent = el.parentNode const pendingNode = parent && parent._pending && parent._pending[vnode.key]