prohibit mounting to body/html

This commit is contained in:
Evan You 2016-08-20 00:46:58 -04:00
parent fc78242a07
commit 16ce0f13d5
1 changed files with 8 additions and 0 deletions

View File

@ -16,6 +16,14 @@ Vue.prototype.$mount = function (
hydrating?: boolean
): Component {
el = el && query(el)
if (el === document.body || el === document.documentElement) {
process.env.NODE_ENV !== 'production' && warn(
`Do not mount Vue to <html> or <body> - mount to normal elements instead.`
)
return this
}
const options = this.$options
// resolve template/el and convert to render function
if (!options.render) {