Skip to content

Commit 7c7c79b

Browse files
committed
only skip script tags if type is javascript (fix #2681)
1 parent e2ef3e8 commit 7c7c79b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/compiler/compile.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export function compile (el, options, partial) {
5353
// link function for the childNodes
5454
var childLinkFn =
5555
!(nodeLinkFn && nodeLinkFn.terminal) &&
56-
el.tagName !== 'SCRIPT' &&
56+
!isScript(el) &&
5757
el.hasChildNodes()
5858
? compileNodeList(el.childNodes, options)
5959
: null
@@ -284,7 +284,7 @@ export function compileRoot (el, options, contextOptions) {
284284

285285
function compileNode (node, options) {
286286
var type = node.nodeType
287-
if (type === 1 && node.tagName !== 'SCRIPT') {
287+
if (type === 1 && !isScript(node)) {
288288
return compileElement(node, options)
289289
} else if (type === 3 && node.data.trim()) {
290290
return compileTextNode(node, options)
@@ -819,3 +819,10 @@ function hasOneTime (tokens) {
819819
if (tokens[i].oneTime) return true
820820
}
821821
}
822+
823+
function isScript (el) {
824+
return el.tagName === 'SCRIPT' && (
825+
!el.hasAttribute('type') ||
826+
el.getAttribute('type') === 'text/javascript'
827+
)
828+
}

0 commit comments

Comments
 (0)