Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

스타일 가이드 - 셀프 클로징 컴포넌트 #29

Open
Bogyie opened this issue Nov 9, 2022 · 0 comments
Open

스타일 가이드 - 셀프 클로징 컴포넌트 #29

Bogyie opened this issue Nov 9, 2022 · 0 comments
Assignees

Comments

@Bogyie
Copy link
Member

Bogyie commented Nov 9, 2022

### 셀프 클로징 컴포넌트 <sup data-p="b">매우 추천함</sup>
**Components with no content should be self-closing in [single-file components](../guide/single-file-components.html), string templates, and [JSX](../guide/render-function.html#JSX) - but never in DOM templates.**
Components that self-close communicate that they not only have no content, but are **meant** to have no content. It's the difference between a blank page in a book and one labeled "This page intentionally left blank." Your code is also cleaner without the unnecessary closing tag.
Unfortunately, HTML doesn't allow custom elements to be self-closing - only [official "void" elements](https://www.w3.org/TR/html/syntax.html#void-elements). That's why the strategy is only possible when Vue's template compiler can reach the template before the DOM, then serve the DOM spec-compliant HTML.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant