diff --git a/dist/vue.common.dev.js b/dist/vue.common.dev.js index ef511fc906e..943ccf68082 100644 --- a/dist/vue.common.dev.js +++ b/dist/vue.common.dev.js @@ -276,15 +276,6 @@ var no = function (a, b, c) { return false; }; */ var identity = function (_) { return _; }; -/** - * Generate a string containing static keys from compiler modules. - */ -function genStaticKeys (modules) { - return modules.reduce(function (keys, m) { - return keys.concat(m.staticKeys || []) - }, []).join(',') -} - /** * Check if two values are loosely equal - that is, * if they are plain objects, do they have the same shape? @@ -2004,29 +1995,6 @@ function nextTick (cb, ctx) { /* */ -var mark; -var measure; - -{ - var perf = inBrowser && window.performance; - /* istanbul ignore if */ - if ( - perf && - perf.mark && - perf.measure && - perf.clearMarks && - perf.clearMeasures - ) { - mark = function (tag) { return perf.mark(tag); }; - measure = function (name, startTag, endTag) { - perf.measure(name, startTag, endTag); - perf.clearMarks(startTag); - perf.clearMarks(endTag); - // perf.clearMeasures(name) - }; - } -} - /* not type checking this file because flow doesn't play well with Proxy */ var initProxy; @@ -2152,6 +2120,29 @@ function _traverse (val, seen) { } } +var mark; +var measure; + +{ + var perf = inBrowser && window.performance; + /* istanbul ignore if */ + if ( + perf && + perf.mark && + perf.measure && + perf.clearMarks && + perf.clearMeasures + ) { + mark = function (tag) { return perf.mark(tag); }; + measure = function (name, startTag, endTag) { + perf.measure(name, startTag, endTag); + perf.clearMarks(startTag); + perf.clearMarks(endTag); + // perf.clearMeasures(name) + }; + } +} + /* */ var normalizeEvent = cached(function (name) { @@ -5599,8 +5590,6 @@ var isSVG = makeMap( true ); -var isPreTag = function (tag) { return tag === 'pre'; }; - var isReservedTag = function (tag) { return isHTMLTag(tag) || isSVG(tag) }; @@ -6814,776 +6803,139 @@ var klass = { /* */ -var validDivisionCharRE = /[\w).+\-_$\]]/; - -function parseFilters (exp) { - var inSingle = false; - var inDouble = false; - var inTemplateString = false; - var inRegex = false; - var curly = 0; - var square = 0; - var paren = 0; - var lastFilterIndex = 0; - var c, prev, i, expression, filters; - - for (i = 0; i < exp.length; i++) { - prev = c; - c = exp.charCodeAt(i); - if (inSingle) { - if (c === 0x27 && prev !== 0x5C) { inSingle = false; } - } else if (inDouble) { - if (c === 0x22 && prev !== 0x5C) { inDouble = false; } - } else if (inTemplateString) { - if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; } - } else if (inRegex) { - if (c === 0x2f && prev !== 0x5C) { inRegex = false; } - } else if ( - c === 0x7C && // pipe - exp.charCodeAt(i + 1) !== 0x7C && - exp.charCodeAt(i - 1) !== 0x7C && - !curly && !square && !paren - ) { - if (expression === undefined) { - // first filter, end of expression - lastFilterIndex = i + 1; - expression = exp.slice(0, i).trim(); - } else { - pushFilter(); - } - } else { - switch (c) { - case 0x22: inDouble = true; break // " - case 0x27: inSingle = true; break // ' - case 0x60: inTemplateString = true; break // ` - case 0x28: paren++; break // ( - case 0x29: paren--; break // ) - case 0x5B: square++; break // [ - case 0x5D: square--; break // ] - case 0x7B: curly++; break // { - case 0x7D: curly--; break // } - } - if (c === 0x2f) { // / - var j = i - 1; - var p = (void 0); - // find first non-whitespace prev char - for (; j >= 0; j--) { - p = exp.charAt(j); - if (p !== ' ') { break } - } - if (!p || !validDivisionCharRE.test(p)) { - inRegex = true; - } - } - } - } - - if (expression === undefined) { - expression = exp.slice(0, i).trim(); - } else if (lastFilterIndex !== 0) { - pushFilter(); - } - - function pushFilter () { - (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim()); - lastFilterIndex = i + 1; - } - - if (filters) { - for (i = 0; i < filters.length; i++) { - expression = wrapFilter(expression, filters[i]); - } - } - - return expression -} - -function wrapFilter (exp, filter) { - var i = filter.indexOf('('); - if (i < 0) { - // _f: resolveFilter - return ("_f(\"" + filter + "\")(" + exp + ")") - } else { - var name = filter.slice(0, i); - var args = filter.slice(i + 1); - return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args)) - } -} - /* */ +/* */ +/* */ -/* eslint-disable no-unused-vars */ -function baseWarn (msg, range) { - console.error(("[Vue compiler]: " + msg)); -} -/* eslint-enable no-unused-vars */ - -function pluckModuleFunction ( - modules, - key -) { - return modules - ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; }) - : [] -} - -function addProp (el, name, value, range, dynamic) { - (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range)); - el.plain = false; -} - -function addAttr (el, name, value, range, dynamic) { - var attrs = dynamic - ? (el.dynamicAttrs || (el.dynamicAttrs = [])) - : (el.attrs || (el.attrs = [])); - attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range)); - el.plain = false; -} - -// add a raw attr (use this in preTransforms) -function addRawAttr (el, name, value, range) { - el.attrsMap[name] = value; - el.attrsList.push(rangeSetItem({ name: name, value: value }, range)); -} - -function addDirective ( - el, - name, - rawName, - value, - arg, - isDynamicArg, - modifiers, - range -) { - (el.directives || (el.directives = [])).push(rangeSetItem({ - name: name, - rawName: rawName, - value: value, - arg: arg, - isDynamicArg: isDynamicArg, - modifiers: modifiers - }, range)); - el.plain = false; -} - -function prependModifierMarker (symbol, name, dynamic) { - return dynamic - ? ("_p(" + name + ",\"" + symbol + "\")") - : symbol + name // mark the event as captured -} - -function addHandler ( - el, - name, - value, - modifiers, - important, - warn, - range, - dynamic -) { - modifiers = modifiers || emptyObject; - // warn prevent and passive modifier - /* istanbul ignore if */ - if ( - warn && - modifiers.prevent && modifiers.passive - ) { - warn( - 'passive and prevent can\'t be used together. ' + - 'Passive handler can\'t prevent default event.', - range - ); - } +// in some cases, the event used has to be determined at runtime +// so we used some reserved tokens during compile. +var RANGE_TOKEN = '__r'; +var CHECKBOX_RADIO_TOKEN = '__c'; - // normalize click.right and click.middle since they don't actually fire - // this is technically browser-specific, but at least for now browsers are - // the only target envs that have right/middle clicks. - if (modifiers.right) { - if (dynamic) { - name = "(" + name + ")==='click'?'contextmenu':(" + name + ")"; - } else if (name === 'click') { - name = 'contextmenu'; - delete modifiers.right; - } - } else if (modifiers.middle) { - if (dynamic) { - name = "(" + name + ")==='click'?'mouseup':(" + name + ")"; - } else if (name === 'click') { - name = 'mouseup'; - } - } +/* */ - // check capture modifier - if (modifiers.capture) { - delete modifiers.capture; - name = prependModifierMarker('!', name, dynamic); - } - if (modifiers.once) { - delete modifiers.once; - name = prependModifierMarker('~', name, dynamic); - } +// normalize v-model event tokens that can only be determined at runtime. +// it's important to place the event as the first in the array because +// the whole point is ensuring the v-model callback gets called before +// user-attached handlers. +function normalizeEvents (on) { /* istanbul ignore if */ - if (modifiers.passive) { - delete modifiers.passive; - name = prependModifierMarker('&', name, dynamic); - } - - var events; - if (modifiers.native) { - delete modifiers.native; - events = el.nativeEvents || (el.nativeEvents = {}); - } else { - events = el.events || (el.events = {}); - } - - var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range); - if (modifiers !== emptyObject) { - newHandler.modifiers = modifiers; + if (isDef(on[RANGE_TOKEN])) { + // IE input[type=range] only supports `change` event + var event = isIE ? 'change' : 'input'; + on[event] = [].concat(on[RANGE_TOKEN], on[event] || []); + delete on[RANGE_TOKEN]; } - - var handlers = events[name]; + // This was originally intended to fix #4521 but no longer necessary + // after 2.5. Keeping it for backwards compat with generated code from < 2.4 /* istanbul ignore if */ - if (Array.isArray(handlers)) { - important ? handlers.unshift(newHandler) : handlers.push(newHandler); - } else if (handlers) { - events[name] = important ? [newHandler, handlers] : [handlers, newHandler]; - } else { - events[name] = newHandler; + if (isDef(on[CHECKBOX_RADIO_TOKEN])) { + on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []); + delete on[CHECKBOX_RADIO_TOKEN]; } - - el.plain = false; } -function getRawBindingAttr ( - el, - name -) { - return el.rawAttrsMap[':' + name] || - el.rawAttrsMap['v-bind:' + name] || - el.rawAttrsMap[name] -} +var target$1; -function getBindingAttr ( - el, - name, - getStatic -) { - var dynamicValue = - getAndRemoveAttr(el, ':' + name) || - getAndRemoveAttr(el, 'v-bind:' + name); - if (dynamicValue != null) { - return parseFilters(dynamicValue) - } else if (getStatic !== false) { - var staticValue = getAndRemoveAttr(el, name); - if (staticValue != null) { - return JSON.stringify(staticValue) +function createOnceHandler$1 (event, handler, capture) { + var _target = target$1; // save current target element in closure + return function onceHandler () { + var res = handler.apply(null, arguments); + if (res !== null) { + remove$2(event, onceHandler, capture, _target); } } } -// note: this only removes the attr from the Array (attrsList) so that it -// doesn't get processed by processAttrs. -// By default it does NOT remove it from the map (attrsMap) because the map is -// needed during codegen. -function getAndRemoveAttr ( - el, +// #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp +// implementation and does not fire microtasks in between event propagation, so +// safe to exclude. +var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53); + +function add$1 ( name, - removeFromMap + handler, + capture, + passive ) { - var val; - if ((val = el.attrsMap[name]) != null) { - var list = el.attrsList; - for (var i = 0, l = list.length; i < l; i++) { - if (list[i].name === name) { - list.splice(i, 1); - break + // async edge case #6566: inner click event triggers patch, event handler + // attached to outer element during patch, and triggered again. This + // happens because browsers fire microtask ticks between event propagation. + // the solution is simple: we save the timestamp when a handler is attached, + // and the handler would only fire if the event passed to it was fired + // AFTER it was attached. + if (useMicrotaskFix) { + var attachedTimestamp = currentFlushTimestamp; + var original = handler; + handler = original._wrapper = function (e) { + if ( + // no bubbling, should always fire. + // this is just a safety net in case event.timeStamp is unreliable in + // certain weird environments... + e.target === e.currentTarget || + // event is fired after handler attachment + e.timeStamp >= attachedTimestamp || + // bail for environments that have buggy event.timeStamp implementations + // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState + // #9681 QtWebEngine event.timeStamp is negative value + e.timeStamp <= 0 || + // #9448 bail if event is fired in another document in a multi-page + // electron/nw.js app, since event.timeStamp will be using a different + // starting reference + e.target.ownerDocument !== document + ) { + return original.apply(this, arguments) } - } - } - if (removeFromMap) { - delete el.attrsMap[name]; + }; } - return val + target$1.addEventListener( + name, + handler, + supportsPassive + ? { capture: capture, passive: passive } + : capture + ); } -function getAndRemoveAttrByRegex ( - el, - name +function remove$2 ( + name, + handler, + capture, + _target ) { - var list = el.attrsList; - for (var i = 0, l = list.length; i < l; i++) { - var attr = list[i]; - if (name.test(attr.name)) { - list.splice(i, 1); - return attr - } - } + (_target || target$1).removeEventListener( + name, + handler._wrapper || handler, + capture + ); } -function rangeSetItem ( - item, - range -) { - if (range) { - if (range.start != null) { - item.start = range.start; - } - if (range.end != null) { - item.end = range.end; - } +function updateDOMListeners (oldVnode, vnode) { + if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) { + return } - return item + var on = vnode.data.on || {}; + var oldOn = oldVnode.data.on || {}; + target$1 = vnode.elm; + normalizeEvents(on); + updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context); + target$1 = undefined; } +var events = { + create: updateDOMListeners, + update: updateDOMListeners +}; + /* */ -/** - * Cross-platform code generation for component v-model - */ -function genComponentModel ( - el, - value, - modifiers -) { - var ref = modifiers || {}; - var number = ref.number; - var trim = ref.trim; - - var baseValueExpression = '$$v'; - var valueExpression = baseValueExpression; - if (trim) { - valueExpression = - "(typeof " + baseValueExpression + " === 'string'" + - "? " + baseValueExpression + ".trim()" + - ": " + baseValueExpression + ")"; - } - if (number) { - valueExpression = "_n(" + valueExpression + ")"; - } - var assignment = genAssignmentCode(value, valueExpression); - - el.model = { - value: ("(" + value + ")"), - expression: JSON.stringify(value), - callback: ("function (" + baseValueExpression + ") {" + assignment + "}") - }; -} +var svgContainer; -/** - * Cross-platform codegen helper for generating v-model value assignment code. - */ -function genAssignmentCode ( - value, - assignment -) { - var res = parseModel(value); - if (res.key === null) { - return (value + "=" + assignment) - } else { - return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")") - } -} - -/** - * Parse a v-model expression into a base path and a final key segment. - * Handles both dot-path and possible square brackets. - * - * Possible cases: - * - * - test - * - test[key] - * - test[test1[key]] - * - test["a"][key] - * - xxx.test[a[a].test1[key]] - * - test.xxx.a["asa"][test1[key]] - * - */ - -var len, str, chr, index$1, expressionPos, expressionEndPos; - - - -function parseModel (val) { - // Fix https://github.com/vuejs/vue/pull/7730 - // allow v-model="obj.val " (trailing whitespace) - val = val.trim(); - len = val.length; - - if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) { - index$1 = val.lastIndexOf('.'); - if (index$1 > -1) { - return { - exp: val.slice(0, index$1), - key: '"' + val.slice(index$1 + 1) + '"' - } - } else { - return { - exp: val, - key: null - } - } - } - - str = val; - index$1 = expressionPos = expressionEndPos = 0; - - while (!eof()) { - chr = next(); - /* istanbul ignore if */ - if (isStringStart(chr)) { - parseString(chr); - } else if (chr === 0x5B) { - parseBracket(chr); - } - } - - return { - exp: val.slice(0, expressionPos), - key: val.slice(expressionPos + 1, expressionEndPos) - } -} - -function next () { - return str.charCodeAt(++index$1) -} - -function eof () { - return index$1 >= len -} - -function isStringStart (chr) { - return chr === 0x22 || chr === 0x27 -} - -function parseBracket (chr) { - var inBracket = 1; - expressionPos = index$1; - while (!eof()) { - chr = next(); - if (isStringStart(chr)) { - parseString(chr); - continue - } - if (chr === 0x5B) { inBracket++; } - if (chr === 0x5D) { inBracket--; } - if (inBracket === 0) { - expressionEndPos = index$1; - break - } - } -} - -function parseString (chr) { - var stringQuote = chr; - while (!eof()) { - chr = next(); - if (chr === stringQuote) { - break - } - } -} - -/* */ - -var warn$1; - -// in some cases, the event used has to be determined at runtime -// so we used some reserved tokens during compile. -var RANGE_TOKEN = '__r'; -var CHECKBOX_RADIO_TOKEN = '__c'; - -function model ( - el, - dir, - _warn -) { - warn$1 = _warn; - var value = dir.value; - var modifiers = dir.modifiers; - var tag = el.tag; - var type = el.attrsMap.type; - - { - // inputs with type="file" are read only and setting the input's - // value will throw an error. - if (tag === 'input' && type === 'file') { - warn$1( - "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" + - "File inputs are read only. Use a v-on:change listener instead.", - el.rawAttrsMap['v-model'] - ); - } - } - - if (el.component) { - genComponentModel(el, value, modifiers); - // component v-model doesn't need extra runtime - return false - } else if (tag === 'select') { - genSelect(el, value, modifiers); - } else if (tag === 'input' && type === 'checkbox') { - genCheckboxModel(el, value, modifiers); - } else if (tag === 'input' && type === 'radio') { - genRadioModel(el, value, modifiers); - } else if (tag === 'input' || tag === 'textarea') { - genDefaultModel(el, value, modifiers); - } else if (!config.isReservedTag(tag)) { - genComponentModel(el, value, modifiers); - // component v-model doesn't need extra runtime - return false - } else { - warn$1( - "<" + (el.tag) + " v-model=\"" + value + "\">: " + - "v-model is not supported on this element type. " + - 'If you are working with contenteditable, it\'s recommended to ' + - 'wrap a library dedicated for that purpose inside a custom component.', - el.rawAttrsMap['v-model'] - ); - } - - // ensure runtime directive metadata - return true -} - -function genCheckboxModel ( - el, - value, - modifiers -) { - var number = modifiers && modifiers.number; - var valueBinding = getBindingAttr(el, 'value') || 'null'; - var trueValueBinding = getBindingAttr(el, 'true-value') || 'true'; - var falseValueBinding = getBindingAttr(el, 'false-value') || 'false'; - addProp(el, 'checked', - "Array.isArray(" + value + ")" + - "?_i(" + value + "," + valueBinding + ")>-1" + ( - trueValueBinding === 'true' - ? (":(" + value + ")") - : (":_q(" + value + "," + trueValueBinding + ")") - ) - ); - addHandler(el, 'change', - "var $$a=" + value + "," + - '$$el=$event.target,' + - "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" + - 'if(Array.isArray($$a)){' + - "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," + - '$$i=_i($$a,$$v);' + - "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" + - "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" + - "}else{" + (genAssignmentCode(value, '$$c')) + "}", - null, true - ); -} - -function genRadioModel ( - el, - value, - modifiers -) { - var number = modifiers && modifiers.number; - var valueBinding = getBindingAttr(el, 'value') || 'null'; - valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding; - addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")")); - addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true); -} - -function genSelect ( - el, - value, - modifiers -) { - var number = modifiers && modifiers.number; - var selectedVal = "Array.prototype.filter" + - ".call($event.target.options,function(o){return o.selected})" + - ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" + - "return " + (number ? '_n(val)' : 'val') + "})"; - - var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]'; - var code = "var $$selectedVal = " + selectedVal + ";"; - code = code + " " + (genAssignmentCode(value, assignment)); - addHandler(el, 'change', code, null, true); -} - -function genDefaultModel ( - el, - value, - modifiers -) { - var type = el.attrsMap.type; - - // warn if v-bind:value conflicts with v-model - // except for inputs with v-bind:type - { - var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value']; - var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type']; - if (value$1 && !typeBinding) { - var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value'; - warn$1( - binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " + - 'because the latter already expands to a value binding internally', - el.rawAttrsMap[binding] - ); - } - } - - var ref = modifiers || {}; - var lazy = ref.lazy; - var number = ref.number; - var trim = ref.trim; - var needCompositionGuard = !lazy && type !== 'range'; - var event = lazy - ? 'change' - : type === 'range' - ? RANGE_TOKEN - : 'input'; - - var valueExpression = '$event.target.value'; - if (trim) { - valueExpression = "$event.target.value.trim()"; - } - if (number) { - valueExpression = "_n(" + valueExpression + ")"; - } - - var code = genAssignmentCode(value, valueExpression); - if (needCompositionGuard) { - code = "if($event.target.composing)return;" + code; - } - - addProp(el, 'value', ("(" + value + ")")); - addHandler(el, event, code, null, true); - if (trim || number) { - addHandler(el, 'blur', '$forceUpdate()'); - } -} - -/* */ - -// normalize v-model event tokens that can only be determined at runtime. -// it's important to place the event as the first in the array because -// the whole point is ensuring the v-model callback gets called before -// user-attached handlers. -function normalizeEvents (on) { - /* istanbul ignore if */ - if (isDef(on[RANGE_TOKEN])) { - // IE input[type=range] only supports `change` event - var event = isIE ? 'change' : 'input'; - on[event] = [].concat(on[RANGE_TOKEN], on[event] || []); - delete on[RANGE_TOKEN]; - } - // This was originally intended to fix #4521 but no longer necessary - // after 2.5. Keeping it for backwards compat with generated code from < 2.4 - /* istanbul ignore if */ - if (isDef(on[CHECKBOX_RADIO_TOKEN])) { - on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []); - delete on[CHECKBOX_RADIO_TOKEN]; - } -} - -var target$1; - -function createOnceHandler$1 (event, handler, capture) { - var _target = target$1; // save current target element in closure - return function onceHandler () { - var res = handler.apply(null, arguments); - if (res !== null) { - remove$2(event, onceHandler, capture, _target); - } - } -} - -// #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp -// implementation and does not fire microtasks in between event propagation, so -// safe to exclude. -var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53); - -function add$1 ( - name, - handler, - capture, - passive -) { - // async edge case #6566: inner click event triggers patch, event handler - // attached to outer element during patch, and triggered again. This - // happens because browsers fire microtask ticks between event propagation. - // the solution is simple: we save the timestamp when a handler is attached, - // and the handler would only fire if the event passed to it was fired - // AFTER it was attached. - if (useMicrotaskFix) { - var attachedTimestamp = currentFlushTimestamp; - var original = handler; - handler = original._wrapper = function (e) { - if ( - // no bubbling, should always fire. - // this is just a safety net in case event.timeStamp is unreliable in - // certain weird environments... - e.target === e.currentTarget || - // event is fired after handler attachment - e.timeStamp >= attachedTimestamp || - // bail for environments that have buggy event.timeStamp implementations - // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState - // #9681 QtWebEngine event.timeStamp is negative value - e.timeStamp <= 0 || - // #9448 bail if event is fired in another document in a multi-page - // electron/nw.js app, since event.timeStamp will be using a different - // starting reference - e.target.ownerDocument !== document - ) { - return original.apply(this, arguments) - } - }; - } - target$1.addEventListener( - name, - handler, - supportsPassive - ? { capture: capture, passive: passive } - : capture - ); -} - -function remove$2 ( - name, - handler, - capture, - _target -) { - (_target || target$1).removeEventListener( - name, - handler._wrapper || handler, - capture - ); -} - -function updateDOMListeners (oldVnode, vnode) { - if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) { - return - } - var on = vnode.data.on || {}; - var oldOn = oldVnode.data.on || {}; - target$1 = vnode.elm; - normalizeEvents(on); - updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context); - target$1 = undefined; -} - -var events = { - create: updateDOMListeners, - update: updateDOMListeners -}; - -/* */ - -var svgContainer; - -function updateDOMProps (oldVnode, vnode) { - if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) { - return +function updateDOMProps (oldVnode, vnode) { + if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) { + return } var key, cur; var elm = vnode.elm; @@ -9062,2877 +8414,4 @@ if (inBrowser) { /* */ -var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g; -var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g; - -var buildRegex = cached(function (delimiters) { - var open = delimiters[0].replace(regexEscapeRE, '\\$&'); - var close = delimiters[1].replace(regexEscapeRE, '\\$&'); - return new RegExp(open + '((?:.|\\n)+?)' + close, 'g') -}); - - - -function parseText ( - text, - delimiters -) { - var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE; - if (!tagRE.test(text)) { - return - } - var tokens = []; - var rawTokens = []; - var lastIndex = tagRE.lastIndex = 0; - var match, index, tokenValue; - while ((match = tagRE.exec(text))) { - index = match.index; - // push text token - if (index > lastIndex) { - rawTokens.push(tokenValue = text.slice(lastIndex, index)); - tokens.push(JSON.stringify(tokenValue)); - } - // tag token - var exp = parseFilters(match[1].trim()); - tokens.push(("_s(" + exp + ")")); - rawTokens.push({ '@binding': exp }); - lastIndex = index + match[0].length; - } - if (lastIndex < text.length) { - rawTokens.push(tokenValue = text.slice(lastIndex)); - tokens.push(JSON.stringify(tokenValue)); - } - return { - expression: tokens.join('+'), - tokens: rawTokens - } -} - -/* */ - -function transformNode (el, options) { - var warn = options.warn || baseWarn; - var staticClass = getAndRemoveAttr(el, 'class'); - if (staticClass) { - var res = parseText(staticClass, options.delimiters); - if (res) { - warn( - "class=\"" + staticClass + "\": " + - 'Interpolation inside attributes has been removed. ' + - 'Use v-bind or the colon shorthand instead. For example, ' + - 'instead of
, use
.', - el.rawAttrsMap['class'] - ); - } - } - if (staticClass) { - el.staticClass = JSON.stringify(staticClass); - } - var classBinding = getBindingAttr(el, 'class', false /* getStatic */); - if (classBinding) { - el.classBinding = classBinding; - } -} - -function genData (el) { - var data = ''; - if (el.staticClass) { - data += "staticClass:" + (el.staticClass) + ","; - } - if (el.classBinding) { - data += "class:" + (el.classBinding) + ","; - } - return data -} - -var klass$1 = { - staticKeys: ['staticClass'], - transformNode: transformNode, - genData: genData -}; - -/* */ - -function transformNode$1 (el, options) { - var warn = options.warn || baseWarn; - var staticStyle = getAndRemoveAttr(el, 'style'); - if (staticStyle) { - /* istanbul ignore if */ - { - var res = parseText(staticStyle, options.delimiters); - if (res) { - warn( - "style=\"" + staticStyle + "\": " + - 'Interpolation inside attributes has been removed. ' + - 'Use v-bind or the colon shorthand instead. For example, ' + - 'instead of
, use
.', - el.rawAttrsMap['style'] - ); - } - } - el.staticStyle = JSON.stringify(parseStyleText(staticStyle)); - } - - var styleBinding = getBindingAttr(el, 'style', false /* getStatic */); - if (styleBinding) { - el.styleBinding = styleBinding; - } -} - -function genData$1 (el) { - var data = ''; - if (el.staticStyle) { - data += "staticStyle:" + (el.staticStyle) + ","; - } - if (el.styleBinding) { - data += "style:(" + (el.styleBinding) + "),"; - } - return data -} - -var style$1 = { - staticKeys: ['staticStyle'], - transformNode: transformNode$1, - genData: genData$1 -}; - -/* */ - -var decoder; - -var he = { - decode: function decode (html) { - decoder = decoder || document.createElement('div'); - decoder.innerHTML = html; - return decoder.textContent - } -}; - -/* */ - -var isUnaryTag = makeMap( - 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' + - 'link,meta,param,source,track,wbr' -); - -// Elements that you can, intentionally, leave open -// (and which close themselves) -var canBeLeftOpenTag = makeMap( - 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source' -); - -// HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3 -// Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content -var isNonPhrasingTag = makeMap( - 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' + - 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' + - 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' + - 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' + - 'title,tr,track' -); - -/** - * Not type-checking this file because it's mostly vendor code. - */ - -// Regular Expressions for parsing tags and attributes -var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/; -var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/; -var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*"; -var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")"; -var startTagOpen = new RegExp(("^<" + qnameCapture)); -var startTagClose = /^\s*(\/?)>/; -var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>")); -var doctype = /^]+>/i; -// #7298: escape - to avoid being pased as HTML comment when inlined in page -var comment = /^', - '"': '"', - '&': '&', - ' ': '\n', - ' ': '\t', - ''': "'" -}; -var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g; -var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g; - -// #5992 -var isIgnoreNewlineTag = makeMap('pre,textarea', true); -var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; }; - -function decodeAttr (value, shouldDecodeNewlines) { - var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr; - return value.replace(re, function (match) { return decodingMap[match]; }) -} - -function parseHTML (html, options) { - var stack = []; - var expectHTML = options.expectHTML; - var isUnaryTag$$1 = options.isUnaryTag || no; - var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no; - var index = 0; - var last, lastTag; - while (html) { - last = html; - // Make sure we're not in a plaintext content element like script/style - if (!lastTag || !isPlainTextElement(lastTag)) { - var textEnd = html.indexOf('<'); - if (textEnd === 0) { - // Comment: - if (comment.test(html)) { - var commentEnd = html.indexOf('-->'); - - if (commentEnd >= 0) { - if (options.shouldKeepComment) { - options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3); - } - advance(commentEnd + 3); - continue - } - } - - // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment - if (conditionalComment.test(html)) { - var conditionalEnd = html.indexOf(']>'); - - if (conditionalEnd >= 0) { - advance(conditionalEnd + 2); - continue - } - } - - // Doctype: - var doctypeMatch = html.match(doctype); - if (doctypeMatch) { - advance(doctypeMatch[0].length); - continue - } - - // End tag: - var endTagMatch = html.match(endTag); - if (endTagMatch) { - var curIndex = index; - advance(endTagMatch[0].length); - parseEndTag(endTagMatch[1], curIndex, index); - continue - } - - // Start tag: - var startTagMatch = parseStartTag(); - if (startTagMatch) { - handleStartTag(startTagMatch); - if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) { - advance(1); - } - continue - } - } - - var text = (void 0), rest = (void 0), next = (void 0); - if (textEnd >= 0) { - rest = html.slice(textEnd); - while ( - !endTag.test(rest) && - !startTagOpen.test(rest) && - !comment.test(rest) && - !conditionalComment.test(rest) - ) { - // < in plain text, be forgiving and treat it as text - next = rest.indexOf('<', 1); - if (next < 0) { break } - textEnd += next; - rest = html.slice(textEnd); - } - text = html.substring(0, textEnd); - } - - if (textEnd < 0) { - text = html; - } - - if (text) { - advance(text.length); - } - - if (options.chars && text) { - options.chars(text, index - text.length, index); - } - } else { - var endTagLength = 0; - var stackedTag = lastTag.toLowerCase(); - var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(]*>)', 'i')); - var rest$1 = html.replace(reStackedTag, function (all, text, endTag) { - endTagLength = endTag.length; - if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') { - text = text - .replace(//g, '$1') // #7298 - .replace(//g, '$1'); - } - if (shouldIgnoreFirstNewline(stackedTag, text)) { - text = text.slice(1); - } - if (options.chars) { - options.chars(text); - } - return '' - }); - index += html.length - rest$1.length; - html = rest$1; - parseEndTag(stackedTag, index - endTagLength, index); - } - - if (html === last) { - options.chars && options.chars(html); - if (!stack.length && options.warn) { - options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length }); - } - break - } - } - - // Clean up any remaining tags - parseEndTag(); - - function advance (n) { - index += n; - html = html.substring(n); - } - - function parseStartTag () { - var start = html.match(startTagOpen); - if (start) { - var match = { - tagName: start[1], - attrs: [], - start: index - }; - advance(start[0].length); - var end, attr; - while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) { - attr.start = index; - advance(attr[0].length); - attr.end = index; - match.attrs.push(attr); - } - if (end) { - match.unarySlash = end[1]; - advance(end[0].length); - match.end = index; - return match - } - } - } - - function handleStartTag (match) { - var tagName = match.tagName; - var unarySlash = match.unarySlash; - - if (expectHTML) { - if (lastTag === 'p' && isNonPhrasingTag(tagName)) { - parseEndTag(lastTag); - } - if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) { - parseEndTag(tagName); - } - } - - var unary = isUnaryTag$$1(tagName) || !!unarySlash; - - var l = match.attrs.length; - var attrs = new Array(l); - for (var i = 0; i < l; i++) { - var args = match.attrs[i]; - var value = args[3] || args[4] || args[5] || ''; - var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href' - ? options.shouldDecodeNewlinesForHref - : options.shouldDecodeNewlines; - attrs[i] = { - name: args[1], - value: decodeAttr(value, shouldDecodeNewlines) - }; - if (options.outputSourceRange) { - attrs[i].start = args.start + args[0].match(/^\s*/).length; - attrs[i].end = args.end; - } - } - - if (!unary) { - stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end }); - lastTag = tagName; - } - - if (options.start) { - options.start(tagName, attrs, unary, match.start, match.end); - } - } - - function parseEndTag (tagName, start, end) { - var pos, lowerCasedTagName; - if (start == null) { start = index; } - if (end == null) { end = index; } - - // Find the closest opened tag of the same type - if (tagName) { - lowerCasedTagName = tagName.toLowerCase(); - for (pos = stack.length - 1; pos >= 0; pos--) { - if (stack[pos].lowerCasedTag === lowerCasedTagName) { - break - } - } - } else { - // If no tag name is provided, clean shop - pos = 0; - } - - if (pos >= 0) { - // Close all the open elements, up the stack - for (var i = stack.length - 1; i >= pos; i--) { - if (i > pos || !tagName && - options.warn - ) { - options.warn( - ("tag <" + (stack[i].tag) + "> has no matching end tag."), - { start: stack[i].start, end: stack[i].end } - ); - } - if (options.end) { - options.end(stack[i].tag, start, end); - } - } - - // Remove the open elements from the stack - stack.length = pos; - lastTag = pos && stack[pos - 1].tag; - } else if (lowerCasedTagName === 'br') { - if (options.start) { - options.start(tagName, [], true, start, end); - } - } else if (lowerCasedTagName === 'p') { - if (options.start) { - options.start(tagName, [], false, start, end); - } - if (options.end) { - options.end(tagName, start, end); - } - } - } -} - -/* */ - -var onRE = /^@|^v-on:/; -var dirRE = /^v-|^@|^:/; -var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/; -var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/; -var stripParensRE = /^\(|\)$/g; -var dynamicArgRE = /^\[.*\]$/; - -var argRE = /:(.*)$/; -var bindRE = /^:|^\.|^v-bind:/; -var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g; - -var slotRE = /^v-slot(:|$)|^#/; - -var lineBreakRE = /[\r\n]/; -var whitespaceRE$1 = /\s+/g; - -var invalidAttributeRE = /[\s"'<>\/=]/; - -var decodeHTMLCached = cached(he.decode); - -var emptySlotScopeToken = "_empty_"; - -// configurable state -var warn$2; -var delimiters; -var transforms; -var preTransforms; -var postTransforms; -var platformIsPreTag; -var platformMustUseProp; -var platformGetTagNamespace; -var maybeComponent; - -function createASTElement ( - tag, - attrs, - parent -) { - return { - type: 1, - tag: tag, - attrsList: attrs, - attrsMap: makeAttrsMap(attrs), - rawAttrsMap: {}, - parent: parent, - children: [] - } -} - -/** - * Convert HTML string to AST. - */ -function parse ( - template, - options -) { - warn$2 = options.warn || baseWarn; - - platformIsPreTag = options.isPreTag || no; - platformMustUseProp = options.mustUseProp || no; - platformGetTagNamespace = options.getTagNamespace || no; - var isReservedTag = options.isReservedTag || no; - maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); }; - - transforms = pluckModuleFunction(options.modules, 'transformNode'); - preTransforms = pluckModuleFunction(options.modules, 'preTransformNode'); - postTransforms = pluckModuleFunction(options.modules, 'postTransformNode'); - - delimiters = options.delimiters; - - var stack = []; - var preserveWhitespace = options.preserveWhitespace !== false; - var whitespaceOption = options.whitespace; - var root; - var currentParent; - var inVPre = false; - var inPre = false; - var warned = false; - - function warnOnce (msg, range) { - if (!warned) { - warned = true; - warn$2(msg, range); - } - } - - function closeElement (element) { - trimEndingWhitespace(element); - if (!inVPre && !element.processed) { - element = processElement(element, options); - } - // tree management - if (!stack.length && element !== root) { - // allow root elements with v-if, v-else-if and v-else - if (root.if && (element.elseif || element.else)) { - { - checkRootConstraints(element); - } - addIfCondition(root, { - exp: element.elseif, - block: element - }); - } else { - warnOnce( - "Component template should contain exactly one root element. " + - "If you are using v-if on multiple elements, " + - "use v-else-if to chain them instead.", - { start: element.start } - ); - } - } - if (currentParent && !element.forbidden) { - if (element.elseif || element.else) { - processIfConditions(element, currentParent); - } else { - if (element.slotScope) { - // scoped slot - // keep it in the children list so that v-else(-if) conditions can - // find it as the prev node. - var name = element.slotTarget || '"default"' - ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element; - } - currentParent.children.push(element); - element.parent = currentParent; - } - } - - // final children cleanup - // filter out scoped slots - element.children = element.children.filter(function (c) { return !(c).slotScope; }); - // remove trailing whitespace node again - trimEndingWhitespace(element); - - // check pre state - if (element.pre) { - inVPre = false; - } - if (platformIsPreTag(element.tag)) { - inPre = false; - } - // apply post-transforms - for (var i = 0; i < postTransforms.length; i++) { - postTransforms[i](element, options); - } - } - - function trimEndingWhitespace (el) { - // remove trailing whitespace node - if (!inPre) { - var lastNode; - while ( - (lastNode = el.children[el.children.length - 1]) && - lastNode.type === 3 && - lastNode.text === ' ' - ) { - el.children.pop(); - } - } - } - - function checkRootConstraints (el) { - if (el.tag === 'slot' || el.tag === 'template') { - warnOnce( - "Cannot use <" + (el.tag) + "> as component root element because it may " + - 'contain multiple nodes.', - { start: el.start } - ); - } - if (el.attrsMap.hasOwnProperty('v-for')) { - warnOnce( - 'Cannot use v-for on stateful component root element because ' + - 'it renders multiple elements.', - el.rawAttrsMap['v-for'] - ); - } - } - - parseHTML(template, { - warn: warn$2, - expectHTML: options.expectHTML, - isUnaryTag: options.isUnaryTag, - canBeLeftOpenTag: options.canBeLeftOpenTag, - shouldDecodeNewlines: options.shouldDecodeNewlines, - shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref, - shouldKeepComment: options.comments, - outputSourceRange: options.outputSourceRange, - start: function start (tag, attrs, unary, start$1, end) { - // check namespace. - // inherit parent ns if there is one - var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag); - - // handle IE svg bug - /* istanbul ignore if */ - if (isIE && ns === 'svg') { - attrs = guardIESVGBug(attrs); - } - - var element = createASTElement(tag, attrs, currentParent); - if (ns) { - element.ns = ns; - } - - { - if (options.outputSourceRange) { - element.start = start$1; - element.end = end; - element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) { - cumulated[attr.name] = attr; - return cumulated - }, {}); - } - attrs.forEach(function (attr) { - if (invalidAttributeRE.test(attr.name)) { - warn$2( - "Invalid dynamic argument expression: attribute names cannot contain " + - "spaces, quotes, <, >, / or =.", - { - start: attr.start + attr.name.indexOf("["), - end: attr.start + attr.name.length - } - ); - } - }); - } - - if (isForbiddenTag(element) && !isServerRendering()) { - element.forbidden = true; - warn$2( - 'Templates should only be responsible for mapping the state to the ' + - 'UI. Avoid placing tags with side-effects in your templates, such as ' + - "<" + tag + ">" + ', as they will not be parsed.', - { start: element.start } - ); - } - - // apply pre-transforms - for (var i = 0; i < preTransforms.length; i++) { - element = preTransforms[i](element, options) || element; - } - - if (!inVPre) { - processPre(element); - if (element.pre) { - inVPre = true; - } - } - if (platformIsPreTag(element.tag)) { - inPre = true; - } - if (inVPre) { - processRawAttrs(element); - } else if (!element.processed) { - // structural directives - processFor(element); - processIf(element); - processOnce(element); - } - - if (!root) { - root = element; - { - checkRootConstraints(root); - } - } - - if (!unary) { - currentParent = element; - stack.push(element); - } else { - closeElement(element); - } - }, - - end: function end (tag, start, end$1) { - var element = stack[stack.length - 1]; - // pop stack - stack.length -= 1; - currentParent = stack[stack.length - 1]; - if (options.outputSourceRange) { - element.end = end$1; - } - closeElement(element); - }, - - chars: function chars (text, start, end) { - if (!currentParent) { - { - if (text === template) { - warnOnce( - 'Component template requires a root element, rather than just text.', - { start: start } - ); - } else if ((text = text.trim())) { - warnOnce( - ("text \"" + text + "\" outside root element will be ignored."), - { start: start } - ); - } - } - return - } - // IE textarea placeholder bug - /* istanbul ignore if */ - if (isIE && - currentParent.tag === 'textarea' && - currentParent.attrsMap.placeholder === text - ) { - return - } - var children = currentParent.children; - if (inPre || text.trim()) { - text = isTextTag(currentParent) ? text : decodeHTMLCached(text); - } else if (!children.length) { - // remove the whitespace-only node right after an opening tag - text = ''; - } else if (whitespaceOption) { - if (whitespaceOption === 'condense') { - // in condense mode, remove the whitespace node if it contains - // line break, otherwise condense to a single space - text = lineBreakRE.test(text) ? '' : ' '; - } else { - text = ' '; - } - } else { - text = preserveWhitespace ? ' ' : ''; - } - if (text) { - if (!inPre && whitespaceOption === 'condense') { - // condense consecutive whitespaces into single space - text = text.replace(whitespaceRE$1, ' '); - } - var res; - var child; - if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) { - child = { - type: 2, - expression: res.expression, - tokens: res.tokens, - text: text - }; - } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') { - child = { - type: 3, - text: text - }; - } - if (child) { - if (options.outputSourceRange) { - child.start = start; - child.end = end; - } - children.push(child); - } - } - }, - comment: function comment (text, start, end) { - // adding anyting as a sibling to the root node is forbidden - // comments should still be allowed, but ignored - if (currentParent) { - var child = { - type: 3, - text: text, - isComment: true - }; - if (options.outputSourceRange) { - child.start = start; - child.end = end; - } - currentParent.children.push(child); - } - } - }); - return root -} - -function processPre (el) { - if (getAndRemoveAttr(el, 'v-pre') != null) { - el.pre = true; - } -} - -function processRawAttrs (el) { - var list = el.attrsList; - var len = list.length; - if (len) { - var attrs = el.attrs = new Array(len); - for (var i = 0; i < len; i++) { - attrs[i] = { - name: list[i].name, - value: JSON.stringify(list[i].value) - }; - if (list[i].start != null) { - attrs[i].start = list[i].start; - attrs[i].end = list[i].end; - } - } - } else if (!el.pre) { - // non root node in pre blocks with no attributes - el.plain = true; - } -} - -function processElement ( - element, - options -) { - processKey(element); - - // determine whether this is a plain element after - // removing structural attributes - element.plain = ( - !element.key && - !element.scopedSlots && - !element.attrsList.length - ); - - processRef(element); - processSlotContent(element); - processSlotOutlet(element); - processComponent(element); - for (var i = 0; i < transforms.length; i++) { - element = transforms[i](element, options) || element; - } - processAttrs(element); - return element -} - -function processKey (el) { - var exp = getBindingAttr(el, 'key'); - if (exp) { - { - if (el.tag === 'template') { - warn$2( - "