Skip to content

Commit

Permalink
fix(runtime-dom): v-cloak should be removed after compile on the root…
Browse files Browse the repository at this point in the history
… element

fix #890
  • Loading branch information
underfin committed Mar 31, 2020
1 parent 412ec86 commit 380ed52
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions packages/runtime-dom/__tests__/directives/vCloak.spec.ts
Original file line number Diff line number Diff line change
@@ -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)
})
})
4 changes: 3 additions & 1 deletion packages/runtime-dom/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 380ed52

Please sign in to comment.