Skip to content

Commit f6f9ea4

Browse files
committed
fix template parsing wrapping wrong elements as svg (fix #2500)
1 parent bf42c15 commit f6f9ea4

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/parsers/template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function isRealTemplate (node) {
7474
return isTemplate(node) && isFragment(node.content)
7575
}
7676

77-
const tagRE = /<([\w:]+)/
77+
const tagRE = /<([\w:-]+)/
7878
const entityRE = /&#?\w+?;/
7979

8080
/**

test/unit/specs/misc_spec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,4 +525,16 @@ describe('Misc', function () {
525525
done()
526526
}
527527
})
528+
529+
// #2500
530+
it('template parser tag match should include hyphen', function () {
531+
var vm = new Vue({
532+
el: document.createElement('div'),
533+
template: '<div>{{{ test }}}</div>',
534+
data: {
535+
test: '<image-field></image-field>'
536+
}
537+
})
538+
expect(vm.$el.querySelector('image-field').namespaceURI).not.toMatch(/svg/)
539+
})
528540
})

0 commit comments

Comments
 (0)