Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Commit f45818a

Browse files
committed
🐛 Use substring instead of serialized tree
1 parent 764c2b3 commit f45818a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/vueTransform.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,15 @@ function parseTemplate (code) {
153153
for (let i = fragment.childNodes.length - 1; i >= 0; i -= 1) {
154154
const name = fragment.childNodes[i].nodeName
155155
if (!(name in nodes)) {
156-
nodes[name] = []
156+
continue
157157
}
158+
159+
const start = fragment.childNodes[i].__location.startTag.endOffset
160+
const end = fragment.childNodes[i].__location.endTag.startOffset
161+
158162
nodes[name].push({
159163
node: fragment.childNodes[i],
160-
code: parse5.serialize(fragment.childNodes[i]),
164+
code: code.substr(start, end - start),
161165
attrs: getNodeAttrs(fragment.childNodes[i])
162166
})
163167
}

0 commit comments

Comments
 (0)