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

Commit b6d475a

Browse files
committed
fix scoped css for <template> due to parse5 upgrade
1 parent 37b1a28 commit b6d475a

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

lib/template-rewriter.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ module.exports = function (id, html) {
3535
function walk (tree, fn) {
3636
if (tree.childNodes) {
3737
tree.childNodes.forEach(function (node) {
38-
fn(node)
39-
walk(node, fn)
38+
if (node.tagName === 'template') {
39+
walk(node.content, fn)
40+
} else {
41+
fn(node)
42+
walk(node, fn)
43+
}
4044
})
4145
}
4246
}

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
@@ -7,4 +7,5 @@
77

88
<template>
99
<div>hi<p class="test">bye</p></div>
10+
<template v-if="ok"><p class="test">yo</p></template>
1011
</template>

0 commit comments

Comments
 (0)