Skip to content
This repository was archived by the owner on Dec 26, 2018. It is now read-only.

Commit 29ea711

Browse files
committed
ix template rewriter when dealing with templates inside <svg>
1 parent cab1d45 commit 29ea711

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

lib/template-rewriter.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,13 @@ module.exports = function (id, html) {
3535
function walk (tree, fn) {
3636
if (tree.childNodes) {
3737
tree.childNodes.forEach(function (node) {
38-
if (node.tagName === 'template') {
38+
var isTemplate = node.tagName === 'template'
39+
if (!isTemplate) {
40+
fn(node)
41+
}
42+
if (isTemplate && node.content) {
3943
walk(node.content, fn)
4044
} else {
41-
fn(node)
4245
walk(node, fn)
4346
}
4447
})

test/expects/scoped.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/fixtures/scoped.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
<template>
99
<div>hi<p class="test">bye</p></div>
1010
<template v-if="ok"><p class="test">yo</p></template>
11+
<svg><template><p></p></template></svg>
1112
</template>

0 commit comments

Comments
 (0)