|
465 | 465 | 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
|
466 | 466 | 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
|
467 | 467 | 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
|
468 |
| - 'required,reversed,scoped,seamless,selected,sortable,translate,' + |
| 468 | + 'required,reversed,scoped,seamless,selected,sortable,' + |
469 | 469 | 'truespeed,typemustmatch,visible'
|
470 | 470 | );
|
471 | 471 |
|
|
483 | 483 | if (isUndef(opts) || opts.Ctor.options.inheritAttrs !== false) {
|
484 | 484 | var parent = node.parent;
|
485 | 485 | while (isDef(parent)) {
|
| 486 | + // Stop fallthrough in case parent has inheritAttrs option set to false |
| 487 | + if (parent.componentOptions && parent.componentOptions.Ctor.options.inheritAttrs === false) { |
| 488 | + break; |
| 489 | + } |
486 | 490 | if (isDef(parent.data) && isDef(parent.data.attrs)) {
|
487 | 491 | attrs = extend(extend({}, attrs), parent.data.attrs);
|
488 | 492 | }
|
|
635 | 639 | } else if (key === 'textContent') {
|
636 | 640 | setText(node, props[key], false);
|
637 | 641 | } else if (key === 'value' && node.tag === 'textarea') {
|
638 |
| - setText(node, props[key], false); |
| 642 | + setText(node, toString(props[key]), false); |
639 | 643 | } else {
|
640 | 644 | // $flow-disable-line (WTF?)
|
641 | 645 | var attr = propsToAttrMap[key] || key.toLowerCase();
|
|
1849 | 1853 | type = [type];
|
1850 | 1854 | }
|
1851 | 1855 | for (var i = 0; i < type.length && !valid; i++) {
|
1852 |
| - var assertedType = assertType(value, type[i]); |
| 1856 | + var assertedType = assertType(value, type[i], vm); |
1853 | 1857 | expectedTypes.push(assertedType.expectedType || '');
|
1854 | 1858 | valid = assertedType.valid;
|
1855 | 1859 | }
|
1856 | 1860 | }
|
1857 | 1861 |
|
1858 |
| - if (!valid) { |
| 1862 | + var haveExpectedTypes = expectedTypes.some(function (t) { return t; }); |
| 1863 | + if (!valid && haveExpectedTypes) { |
1859 | 1864 | warn(
|
1860 | 1865 | getInvalidTypeMessage(name, value, expectedTypes),
|
1861 | 1866 | vm
|
|
1873 | 1878 | }
|
1874 | 1879 | }
|
1875 | 1880 |
|
1876 |
| - var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/; |
| 1881 | + var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/; |
1877 | 1882 |
|
1878 |
| - function assertType (value, type) { |
| 1883 | + function assertType (value, type, vm) { |
1879 | 1884 | var valid;
|
1880 | 1885 | var expectedType = getType(type);
|
1881 | 1886 | if (simpleCheckRE.test(expectedType)) {
|
|
1890 | 1895 | } else if (expectedType === 'Array') {
|
1891 | 1896 | valid = Array.isArray(value);
|
1892 | 1897 | } else {
|
1893 |
| - valid = value instanceof type; |
| 1898 | + try { |
| 1899 | + valid = value instanceof type; |
| 1900 | + } catch (e) { |
| 1901 | + warn('Invalid prop type: "' + String(type) + '" is not a constructor', vm); |
| 1902 | + valid = false; |
| 1903 | + } |
1894 | 1904 | }
|
1895 | 1905 | return {
|
1896 | 1906 | valid: valid,
|
1897 | 1907 | expectedType: expectedType
|
1898 | 1908 | }
|
1899 | 1909 | }
|
1900 | 1910 |
|
| 1911 | + var functionTypeCheckRE = /^\s*function (\w+)/; |
| 1912 | + |
1901 | 1913 | /**
|
1902 | 1914 | * Use function string name to check built-in types,
|
1903 | 1915 | * because a simple equality check will fail when running
|
1904 | 1916 | * across different vms / iframes.
|
1905 | 1917 | */
|
1906 | 1918 | function getType (fn) {
|
1907 |
| - var match = fn && fn.toString().match(/^\s*function (\w+)/); |
| 1919 | + var match = fn && fn.toString().match(functionTypeCheckRE); |
1908 | 1920 | return match ? match[1] : ''
|
1909 | 1921 | }
|
1910 | 1922 |
|
|
1929 | 1941 | " Expected " + (expectedTypes.map(capitalize).join(', '));
|
1930 | 1942 | var expectedType = expectedTypes[0];
|
1931 | 1943 | var receivedType = toRawType(value);
|
1932 |
| - var expectedValue = styleValue(value, expectedType); |
1933 |
| - var receivedValue = styleValue(value, receivedType); |
1934 | 1944 | // check if we need to specify expected value
|
1935 |
| - if (expectedTypes.length === 1 && |
1936 |
| - isExplicable(expectedType) && |
1937 |
| - !isBoolean(expectedType, receivedType)) { |
1938 |
| - message += " with value " + expectedValue; |
| 1945 | + if ( |
| 1946 | + expectedTypes.length === 1 && |
| 1947 | + isExplicable(expectedType) && |
| 1948 | + isExplicable(typeof value) && |
| 1949 | + !isBoolean(expectedType, receivedType) |
| 1950 | + ) { |
| 1951 | + message += " with value " + (styleValue(value, expectedType)); |
1939 | 1952 | }
|
1940 | 1953 | message += ", got " + receivedType + " ";
|
1941 | 1954 | // check if we need to specify received value
|
1942 | 1955 | if (isExplicable(receivedType)) {
|
1943 |
| - message += "with value " + receivedValue + "."; |
| 1956 | + message += "with value " + (styleValue(value, receivedType)) + "."; |
1944 | 1957 | }
|
1945 | 1958 | return message
|
1946 | 1959 | }
|
|
1955 | 1968 | }
|
1956 | 1969 | }
|
1957 | 1970 |
|
| 1971 | + var EXPLICABLE_TYPES = ['string', 'number', 'boolean']; |
1958 | 1972 | function isExplicable (value) {
|
1959 |
| - var explicitTypes = ['string', 'number', 'boolean']; |
1960 |
| - return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; }) |
| 1973 | + return EXPLICABLE_TYPES.some(function (elem) { return value.toLowerCase() === elem; }) |
1961 | 1974 | }
|
1962 | 1975 |
|
1963 | 1976 | function isBoolean () {
|
|
2172 | 2185 | // contain child elements.
|
2173 | 2186 | var isSVG = makeMap(
|
2174 | 2187 | 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
|
2175 |
| - 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' + |
| 2188 | + 'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' + |
2176 | 2189 | 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
|
2177 | 2190 | true
|
2178 | 2191 | );
|
|
3366 | 3379 |
|
3367 | 3380 | // Regular Expressions for parsing tags and attributes
|
3368 | 3381 | var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
|
3369 |
| - var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/; |
| 3382 | + var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/; |
3370 | 3383 | var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
|
3371 | 3384 | var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
|
3372 | 3385 | var startTagOpen = new RegExp(("^<" + qnameCapture));
|
|
3819 | 3832 | var slotRE = /^v-slot(:|$)|^#/;
|
3820 | 3833 |
|
3821 | 3834 | var lineBreakRE = /[\r\n]/;
|
3822 |
| - var whitespaceRE = /\s+/g; |
| 3835 | + var whitespaceRE = /[ \f\t\r\n]+/g; |
3823 | 3836 |
|
3824 | 3837 | var invalidAttributeRE = /[\s"'<>\/=]/;
|
3825 | 3838 |
|
|
3867 | 3880 | platformMustUseProp = options.mustUseProp || no;
|
3868 | 3881 | platformGetTagNamespace = options.getTagNamespace || no;
|
3869 | 3882 | var isReservedTag = options.isReservedTag || no;
|
3870 |
| - maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); }; |
3871 |
| - |
| 3883 | + maybeComponent = function (el) { return !!( |
| 3884 | + el.component || |
| 3885 | + el.attrsMap[':is'] || |
| 3886 | + el.attrsMap['v-bind:is'] || |
| 3887 | + !(el.attrsMap.is ? isReservedTag(el.attrsMap.is) : isReservedTag(el.tag)) |
| 3888 | + ); }; |
3872 | 3889 | transforms = pluckModuleFunction(options.modules, 'transformNode');
|
3873 | 3890 | preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
|
3874 | 3891 | postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
|
|
5156 | 5173 | code += genModifierCode;
|
5157 | 5174 | }
|
5158 | 5175 | var handlerCode = isMethodPath
|
5159 |
| - ? ("return " + (handler.value) + "($event)") |
| 5176 | + ? ("return " + (handler.value) + ".apply(null, arguments)") |
5160 | 5177 | : isFunctionExpression
|
5161 |
| - ? ("return (" + (handler.value) + ")($event)") |
| 5178 | + ? ("return (" + (handler.value) + ").apply(null, arguments)") |
5162 | 5179 | : isFunctionInvocation
|
5163 | 5180 | ? ("return " + (handler.value))
|
5164 | 5181 | : handler.value;
|
|
5244 | 5261 | options
|
5245 | 5262 | ) {
|
5246 | 5263 | var state = new CodegenState(options);
|
5247 |
| - var code = ast ? genElement(ast, state) : '_c("div")'; |
| 5264 | + // fix #11483, Root level <script> tags should not be rendered. |
| 5265 | + var code = ast ? (ast.tag === 'script' ? 'null' : genElement(ast, state)) : '_c("div")'; |
5248 | 5266 | return {
|
5249 | 5267 | render: ("with(this){return " + code + "}"),
|
5250 | 5268 | staticRenderFns: state.staticRenderFns
|
|
5706 | 5724 | function genSlot (el, state) {
|
5707 | 5725 | var slotName = el.slotName || '"default"';
|
5708 | 5726 | var children = genChildren(el, state);
|
5709 |
| - var res = "_t(" + slotName + (children ? ("," + children) : ''); |
| 5727 | + var res = "_t(" + slotName + (children ? (",function(){return " + children + "}") : ''); |
5710 | 5728 | var attrs = el.attrs || el.dynamicAttrs
|
5711 | 5729 | ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
|
5712 | 5730 | // slot props are camelized
|
|
6840 | 6858 | var allowedGlobals = makeMap(
|
6841 | 6859 | 'Infinity,undefined,NaN,isFinite,isNaN,' +
|
6842 | 6860 | 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
|
6843 |
| - 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' + |
| 6861 | + 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' + |
6844 | 6862 | 'require' // for Webpack/Browserify
|
6845 | 6863 | );
|
6846 | 6864 |
|
|
7243 | 7261 | */
|
7244 | 7262 | function renderSlot (
|
7245 | 7263 | name,
|
7246 |
| - fallback, |
| 7264 | + fallbackRender, |
7247 | 7265 | props,
|
7248 | 7266 | bindObject
|
7249 | 7267 | ) {
|
7250 | 7268 | var scopedSlotFn = this.$scopedSlots[name];
|
7251 | 7269 | var nodes;
|
7252 |
| - if (scopedSlotFn) { // scoped slot |
| 7270 | + if (scopedSlotFn) { |
| 7271 | + // scoped slot |
7253 | 7272 | props = props || {};
|
7254 | 7273 | if (bindObject) {
|
7255 | 7274 | if (!isObject(bindObject)) {
|
7256 |
| - warn( |
7257 |
| - 'slot v-bind without argument expects an Object', |
7258 |
| - this |
7259 |
| - ); |
| 7275 | + warn('slot v-bind without argument expects an Object', this); |
7260 | 7276 | }
|
7261 | 7277 | props = extend(extend({}, bindObject), props);
|
7262 | 7278 | }
|
7263 |
| - nodes = scopedSlotFn(props) || fallback; |
| 7279 | + nodes = |
| 7280 | + scopedSlotFn(props) || |
| 7281 | + (typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender); |
7264 | 7282 | } else {
|
7265 |
| - nodes = this.$slots[name] || fallback; |
| 7283 | + nodes = |
| 7284 | + this.$slots[name] || |
| 7285 | + (typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender); |
7266 | 7286 | }
|
7267 | 7287 |
|
7268 | 7288 | var target = props && props.slot;
|
|
7312 | 7332 | } else if (eventKeyName) {
|
7313 | 7333 | return hyphenate(eventKeyName) !== key
|
7314 | 7334 | }
|
| 7335 | + return eventKeyCode === undefined |
7315 | 7336 | }
|
7316 | 7337 |
|
7317 | 7338 | /* */
|
|
7580 | 7601 |
|
7581 | 7602 | /* */
|
7582 | 7603 |
|
| 7604 | + function isAsyncPlaceholder (node) { |
| 7605 | + return node.isComment && node.asyncFactory |
| 7606 | + } |
| 7607 | + |
| 7608 | + /* */ |
| 7609 | + |
7583 | 7610 | function normalizeScopedSlots (
|
7584 | 7611 | slots,
|
7585 | 7612 | normalSlots,
|
|
7636 | 7663 | res = res && typeof res === 'object' && !Array.isArray(res)
|
7637 | 7664 | ? [res] // single vnode
|
7638 | 7665 | : normalizeChildren(res);
|
| 7666 | + var vnode = res && res[0]; |
7639 | 7667 | return res && (
|
7640 |
| - res.length === 0 || |
7641 |
| - (res.length === 1 && res[0].isComment) // #9658 |
| 7668 | + !vnode || |
| 7669 | + (vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391 |
7642 | 7670 | ) ? undefined
|
7643 | 7671 | : res
|
7644 | 7672 | };
|
|
7818 | 7846 |
|
7819 | 7847 | /* */
|
7820 | 7848 |
|
7821 |
| - /* */ |
7822 |
| - |
7823 | 7849 | var target;
|
7824 | 7850 |
|
7825 | 7851 | function add (event, fn) {
|
|
7873 | 7899 | var hasDynamicScopedSlot = !!(
|
7874 | 7900 | (newScopedSlots && !newScopedSlots.$stable) ||
|
7875 | 7901 | (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
|
7876 |
| - (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) |
| 7902 | + (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) || |
| 7903 | + (!newScopedSlots && vm.$scopedSlots.$key) |
7877 | 7904 | );
|
7878 | 7905 |
|
7879 | 7906 | // Any static slot children from the parent may have changed during parent's
|
|
8417 | 8444 | }
|
8418 | 8445 |
|
8419 | 8446 | function createComponentInstanceForVnode (
|
8420 |
| - vnode, // we know it's MountedComponentVNode but flow doesn't |
8421 |
| - parent // activeInstance in lifecycle state |
| 8447 | + // we know it's MountedComponentVNode but flow doesn't |
| 8448 | + vnode, |
| 8449 | + // activeInstance in lifecycle state |
| 8450 | + parent |
8422 | 8451 | ) {
|
8423 | 8452 | var options = {
|
8424 | 8453 | _isComponent: true,
|
|
0 commit comments