Skip to content

Commit 0288b5b

Browse files
committed
fix(src/core/vdom/patch.js): fix the bug 'root level <script> tags will be executed' in issue#11483
Root level <script> tags should not be executed, for consistent behavior. So I remove the code in <script> tag when the <script> tag is the root element of the template. fix vuejs#11483
1 parent 8ead9d2 commit 0288b5b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/core/vdom/patch.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,10 @@ export function createPatchFunction (backend) {
188188
insert(parentElm, vnode.elm, refElm)
189189
}
190190
} else {
191-
createChildren(vnode, children, insertedVnodeQueue)
191+
// fix:11483, remove the code in <script> tag when the <script> tag is the root element of the template.
192+
if (vnode.tag !== 'script') {
193+
createChildren(vnode, children, insertedVnodeQueue)
194+
}
192195
if (isDef(data)) {
193196
invokeCreateHooks(vnode, insertedVnodeQueue)
194197
}

0 commit comments

Comments
 (0)