Skip to content

Commit b3faa27

Browse files
committed
fix #569 script tags not skipped properly
1 parent 7a1526d commit b3faa27

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/compile/compile.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ module.exports = function compile (el, options, partial) {
2525
? null
2626
: compileNode(el, options)
2727
var childLinkFn =
28-
(!nodeLinkFn || !nodeLinkFn.terminal) &&
28+
!(nodeLinkFn && nodeLinkFn.terminal) &&
29+
el.tagName !== 'SCRIPT' &&
2930
el.hasChildNodes()
3031
? compileNodeList(el.childNodes, options)
3132
: null
@@ -266,7 +267,8 @@ function compileNodeList (nodeList, options) {
266267
node = nodeList[i]
267268
nodeLinkFn = compileNode(node, options)
268269
childLinkFn =
269-
(!nodeLinkFn || !nodeLinkFn.terminal) &&
270+
!(nodeLinkFn && nodeLinkFn.terminal) &&
271+
node.tagName !== 'SCRIPT' &&
270272
node.hasChildNodes()
271273
? compileNodeList(node.childNodes, options)
272274
: null

test/unit/specs/compile/compile_spec.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,5 +196,12 @@ if (_.inBrowser) {
196196
expect(vm._directives.length).toBe(0)
197197
})
198198

199+
it('skip script tags', function () {
200+
el.innerHTML = '<script type="x/template">{{test}}</script>'
201+
var linker = compile(el, Vue.options)
202+
linker(vm, el)
203+
expect(vm._bindDir.calls.count()).toBe(0)
204+
})
205+
199206
})
200207
}

0 commit comments

Comments
 (0)