Skip to content

Commit 16ce0f1

Browse files
committed
prohibit mounting to body/html
1 parent fc78242 commit 16ce0f1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/entries/web-runtime-with-compiler.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ Vue.prototype.$mount = function (
1616
hydrating?: boolean
1717
): Component {
1818
el = el && query(el)
19+
20+
if (el === document.body || el === document.documentElement) {
21+
process.env.NODE_ENV !== 'production' && warn(
22+
`Do not mount Vue to <html> or <body> - mount to normal elements instead.`
23+
)
24+
return this
25+
}
26+
1927
const options = this.$options
2028
// resolve template/el and convert to render function
2129
if (!options.render) {

0 commit comments

Comments
 (0)