Skip to content

Commit c1bb44a

Browse files
committed
add warning when mounting instance to <body> with template
1 parent 4c6b69e commit c1bb44a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/compiler/transclude.js

+8
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ function transcludeTemplate (el, options) {
6565
var replacer = frag.firstChild
6666
var tag = replacer.tagName && replacer.tagName.toLowerCase()
6767
if (options.replace) {
68+
/* istanbul ignore if */
69+
if (el === document.body) {
70+
_.warn(
71+
'You are mounting an instance with a template to ' +
72+
'<body>. This will replace <body> entirely. You ' +
73+
'should probably use `replace: false` here.'
74+
)
75+
}
6876
if (
6977
// multi-children template
7078
frag.childNodes.length > 1 ||

0 commit comments

Comments
 (0)