Vue: Disable comment stripping in Vue template

Created on 8 Jan 2018  ·  2Comments  ·  Source: vuejs/vue

Version

2.5.13

Reproduction link

https://jsfiddle.net/tf7ja0y4/1/

Steps to reproduce

Add an HTML block that contains comments with pre directive at the root level. When it's rendered, you'll notice the inline comments have been stripped out.

What is expected?

Inline comments and all the markup remains untouched by Vue

What is actually happening?

Vue still seems to parse/compile the contents that are inside the pre directive


If pre is not supposed to work that way, I'd love to find another way to disable comment stripping. The reason I need this is because I'm using some legacy KnockoutJS markup inside a larger Vue VM. And some of the KnockoutJS syntax allows using comment bindings/directives which are being stripped out by Vue.

Most helpful comment

Please read https://vuejs.org/v2/api/#comments and use latest Vue version,because you are using 2.0.1 in your example :)

https://jsfiddle.net/vbyc2r5r/

All 2 comments

Please read https://vuejs.org/v2/api/#comments and use latest Vue version,because you are using 2.0.1 in your example :)

https://jsfiddle.net/vbyc2r5r/

@sqal Awesome, thanks!

Was this page helpful?
0 / 5 - 0 ratings