From 16ce0f13d5e701821c5b64cf73d851b6762906c9 Mon Sep 17 00:00:00 2001 From: Evan You Date: Sat, 20 Aug 2016 00:46:58 -0400 Subject: [PATCH] prohibit mounting to body/html --- src/entries/web-runtime-with-compiler.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/entries/web-runtime-with-compiler.js b/src/entries/web-runtime-with-compiler.js index 6ba3d42f6..5a014fab6 100644 --- a/src/entries/web-runtime-with-compiler.js +++ b/src/entries/web-runtime-with-compiler.js @@ -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 or - mount to normal elements instead.` + ) + return this + } + const options = this.$options // resolve template/el and convert to render function if (!options.render) {