diff --git a/packages/runtime-dom/__tests__/directives/vCloak.spec.ts b/packages/runtime-dom/__tests__/directives/vCloak.spec.ts new file mode 100644 index 00000000..61de3c76 --- /dev/null +++ b/packages/runtime-dom/__tests__/directives/vCloak.spec.ts @@ -0,0 +1,10 @@ +import { createApp } from '@vue/runtime-dom' + +describe('vCloak', () => { + test('should be removed after compile', () => { + const root = document.createElement('div') + root.setAttribute('v-cloak', '') + createApp({}).mount(root) + expect(root.hasAttribute('v-cloak')).toBe(false) + }) +}) diff --git a/packages/runtime-dom/src/index.ts b/packages/runtime-dom/src/index.ts index 26b188f0..5bebbced 100644 --- a/packages/runtime-dom/src/index.ts +++ b/packages/runtime-dom/src/index.ts @@ -63,7 +63,9 @@ export const createApp = ((...args) => { } // clear content before mounting container.innerHTML = '' - return mount(container) + const proxy = mount(container) + container.removeAttribute('v-cloak') + return proxy } return app