### Version 2.6.10 ### Reproduction link [https://github.com/yinxin630/vue-issue-example](https://github.com/yinxin630/vue-issue-example) ### Steps to reproduce 1. clone and npm i 2. run `npm run build` and `npm run build:ssr` 3. run `node src/ssr.js` 4. render app.js with ssr get result ```html <div id="app" data-server-rendered="true"><!----><h2>2222222222</h2></div> ``` 5. open in browser. client-side hydration will throw error `Uncaught TypeError: n.setAttribute is not a function` ### What is expected? client-side hydration success ### What is actually happening? throw error `Uncaught TypeError: n.setAttribute is not a function` --- I found this when debug. vue call `n.setAttribute('class', 'm-image-padding')` but n is a comment node. In `app.js` I use `v-if`. It will be true when ssr but be false when csr. I don't know if there is something wrong with my usage or the logic of vue client-side hydration. <!-- generated by vue-issues. DO NOT REMOVE -->