Closed
Description
Version
3.0.7
Reproduction link
https://jsfiddle.net/akgpf058/
Steps to reproduce
Vue.compile(`<h2>Todos:</h2><!-- COMMENT HERE -->`, {comments: false});
See result where comment nodes are in place (even with comments: false
option):
(function anonymous(
) {
const _Vue = Vue
const { createVNode: _createVNode, createCommentVNode: _createCommentVNode } = _Vue
const _hoisted_1 = /*#__PURE__*/_createVNode("h2", null, "Todos:", -1 /* HOISTED */)
return function render(_ctx, _cache) {
with (_ctx) {
const { createVNode: _createVNode, createCommentVNode: _createCommentVNode, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock } = _Vue
return (_openBlock(), _createBlock(_Fragment, null, [
_hoisted_1,
_createCommentVNode(" COMMENT HERE ")
], 2112 /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */))
}
}
})
What is expected?
Returned result without comment nodes being rendered.
What is actually happening?
Comment nodes are in place: _createCommentVNode(" COMMENT HERE ")
I would appreciate any feedback on how to precompile template without comment nodes, my understanding that Vue has option to remove comment nodes from template, but I can be misreading source code, let me know if there any other way to make Vue.compile
trim comments (there are should be one, I guess?).