-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Allow Custom Elements to be self-closing. #11461
Comments
AFAIK custom elements can't be made void or self-closing, so I think it's better if they behaved consistently and required the closing tag. |
@CaptainCodeman did you read the linked issue on the Web Incubator Community Group? (WICG/webcomponents#624) There is an overwhelming support for self-closing web component tags from the community (with regular xml semantics), and an equally overwhelming reluctance to change parser semantics from the browser makers. Based on the history of parser evolution I fully understand the browser makers, however, .svelte files are not legal html and as such have opportunities for improving DX that the browser makers do not have. Legal html would still be paste-able into .svelte files (and legal svelte have never been paste-able into .html files. This issue would not change that. Svelte components must be imported and can be self-closing, this would only extend that to Web Components, thus making the syntax more consistent. |
It's better to be consistent here. Either we could've kept it as before and allow self-closing for all elements (we changed that), or we warn on all to align with the spec. Having a weird middle ground would confuse both sides. Therefore closing. |
Describe the problem
Almost everyone was surprised about the real semantics of
<div/>
, this issue is not about that ;-)Custom Elements/Web Components always have a dash/hypen in the tag name (
<my-element...>
/ ` / etc.)The ergonomics of
is just much better than
and the semantics are very clear as well ...oh, and the last version has a subtle issue that is hard for end-users to find.
WaltzingPenguin describes it well: WICG/webcomponents#624 (comment)
I'll further argue by appealing to the authority of uncle Timmy (Tim Peters) in the Zen of Python (
python -c "import this"
);-)
Describe the proposed solution
What would I like to happen? That self-closing web-component tags, e.g.
<fa-icon name="key"/>
do the sensible and expected thing, i.e. magically insert the closing tag and not issue a warning.I'm explicitly not asking for self-closing regular tags (e.g.
<div/>
), nor for web-component void tags (i.e.<fa-icon name="key">
- without the slash).The reason this has not been done in the spec is mainly implementor resistance (which I understand well, I lived through the xhtml era), not that it isn't the right thing to do.
Importance
nice to have
The text was updated successfully, but these errors were encountered: