wip: initial compat build setup
This commit is contained in:
@@ -13,7 +13,15 @@ import {
|
||||
import { nodeOps } from './nodeOps'
|
||||
import { patchProp, forcePatchProp } from './patchProp'
|
||||
// Importing from the compiler, will be tree-shaken in prod
|
||||
import { isFunction, isString, isHTMLTag, isSVGTag, extend } from '@vue/shared'
|
||||
import {
|
||||
isFunction,
|
||||
isString,
|
||||
isHTMLTag,
|
||||
isSVGTag,
|
||||
extend,
|
||||
warnDeprecation,
|
||||
DeprecationTypes
|
||||
} from '@vue/shared'
|
||||
|
||||
declare module '@vue/reactivity' {
|
||||
export interface RefUnwrapBailTypes {
|
||||
@@ -63,8 +71,24 @@ export const createApp = ((...args) => {
|
||||
app.mount = (containerOrSelector: Element | ShadowRoot | string): any => {
|
||||
const container = normalizeContainer(containerOrSelector)
|
||||
if (!container) return
|
||||
|
||||
// 2.x compat check
|
||||
if (__COMPAT__ && __DEV__) {
|
||||
for (let i = 0; i < container.attributes.length; i++) {
|
||||
const attr = container.attributes[i]
|
||||
if (attr.name !== 'v-cloak' && /^(v-|:|@)/.test(attr.name)) {
|
||||
warnDeprecation(DeprecationTypes.DOM_TEMPLATE_MOUNT)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const component = app._component
|
||||
if (!isFunction(component) && !component.render && !component.template) {
|
||||
// __UNSAFE__
|
||||
// Reason: potential execution of JS expressions in in-DOM template.
|
||||
// The user must make sure the in-DOM template is trusted. If it's
|
||||
// rendered by the server, the template should not contain any user data.
|
||||
component.template = container.innerHTML
|
||||
}
|
||||
// clear content before mounting
|
||||
|
||||
Reference in New Issue
Block a user